0.3.9 • Published 2 years ago

react-d3-bar-graph v0.3.9

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

react-d3-bar-graph

npm npm

A component that renders a bar graph using d3

Install

npm install --save react-d3-bar-graph

or

yarn add react-d3-bar-graph

Import

import { BarGraph } from "react-d3-bar-graph";

Usage

<BarGraph
  width={400}
  height={400}
  yRange={100}
  xValue="song"
  yValue="popularity"
  data={data}
  ticks={3}
  axisStyles={{
    color: "#0BC5EA",
    "font-size": "15px",
  }}
  title="Most popular songs"
  xAxisSlanted={true}
  colors={["purple", "red", "black"]}
/>

Props

PropertyTypeRequiredDefaultDescription
dataArraytrue-An array to map the data
xValueStringtrue-Value to map x-axis
yValueStringtrue-Value to map y-axis
yRangeNumbertrue-Max y range
ticksNumberfalse5Number of ticks on y-axis
widthNumberfalse400Width of the graph
heightNumberfalse400Height of the graph
stylesObjectfalse-How to style the graph and bars (ex: {{fill: "red"}} (Note: Using fill will override the colors prop)
xAxisStylesObjectfalse-How to style the x-axis (ex: {{color: "purple"}})
yAxisStylesObjectfalse-How to style the y-axis (ex: {{color: "purple"}})
axisStylesObjectfalse-How to style both x and y axis (overrides xAxisStyles and yAxisStyles prop)
xAxisSlantedBooleanfalsefalseWhether to make the x-axis labels slanted
titleStringfalse""Title of the graph
titleStylesObjectfalse-How to style the title
colorsArrayfalse"black", "red"How to style individual bars
0.3.9

2 years ago

0.3.8

2 years ago

0.3.7

2 years ago

0.3.6

2 years ago

0.3.5

2 years ago

0.3.4

2 years ago

0.3.3

2 years ago

0.3.2

2 years ago

0.3.1

2 years ago

0.3.0

2 years ago

0.2.9

2 years ago

0.2.8

2 years ago

0.2.7

2 years ago

0.2.6

2 years ago

0.2.5

2 years ago

0.2.4

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago