0.3.9 • Published 3 years ago

react-d3-bar-graph v0.3.9

Weekly downloads
-
License
MIT
Repository
github
Last release
3 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

3 years ago

0.3.8

3 years ago

0.3.7

3 years ago

0.3.6

3 years ago

0.3.5

3 years ago

0.3.4

3 years ago

0.3.3

3 years ago

0.3.2

3 years ago

0.3.1

3 years ago

0.3.0

3 years ago

0.2.9

3 years ago

0.2.8

3 years ago

0.2.7

3 years ago

0.2.6

3 years ago

0.2.5

3 years ago

0.2.4

3 years ago

0.2.3

3 years ago

0.2.2

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.9

3 years ago

0.1.8

3 years ago

0.1.7

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago