Modular ReactJS charts made using d3 chart utilities. Work on project documentation has started here. A few examples of the available charts can be seen below, the others can be viewed here, side-by-side with the React code that generates the charts.
Caution: alpha state software. Chart APIs will change. Breaking changes will occur at each minor (0.x) release, until we reach version 1.0. At that point, we'll closely follow the semver specification.
First, install via npm:
npm install react-d3
Then, import into your ReactJS project:
var rd3 = require('react-d3');
The charts are then available under the rd3 namespace, which you can then use as shown on the demonstration page:
var BarChart = rd3.BarChart;
var LineChart = rd3.LineChart;
var PieChart = rd3.PieChart;
var AreaChart = rd3.AreaChart;
var Treemap = rd3.Treemap;
var ScatterChart = rd3.ScatterChart;
For usage, please see here. API documentation is also coming online over the coming days.
There's a development build available for experimentation on JSFiddle: http://jsfiddle.net/esbullington/jp9dkh1g/
Please note that this build should probably not be used in production, since it bundles all of react-d3's dependencies in a single bundle (this is also the cause of the "Cannot read property 'firstChild' of undefined" error message on the JS console, which occurs when there are two React libraries in the same namespace).
All the react-d3 charts are available in this JSFiddle fork under the global rd3 namespace.
- Chat:
- Issues: react-d3 issues on Github
- Support: react-d3 Google Groups email list
Although there have been several different approaches proposed for combining the power of d3 with the flexibility and modularity of ReactJS, the approach I'm using here was inspired by this blog post by Ben Smith of Binary Consulting. Basically, it uses React to generate a chart's svg components using stateless React components.
With this approach, ReactJS itself is responsible for the SVG markup. d3 is used for its tremendous collection of utility functions, such as those that calculate the path value for various chart types.
However, I've diverged a bit from this original vision and am storing a bit of state in top-level chart components in order to leverage d3's axis generators, at least until I develop native React chart axes.
-
v0.3.0:
- Additional charts types:
- candlestick
- table
- Axes labels
- Tooltips
- Additional charts types:
-
v0.4.0:
- Additional charts types:
- slopegraphs
- Pure React axes
- Additional charts types:
-
v0.5.0:
- Data frame animations
####0.2.0:
- Added scatterchart (Thanks @yang-wei!)
- Adopted consistent data format for multi-series chart
- Mouseover animation for both line chart and scatter chart
- Added JSHinting
- Factored out axes
- Added chart legend
####0.1.0:
- Added treemap (Thanks @yang-wei!)
- Restructured project for improved npm compatibility
- Harmonized chart palettes
- Fixed non-initial-render for charts with axes (contributions from @tarrencev and @unbracketed)
- Improved documentation (contribution from @jeffriesen)
- Improved chart APIs (contribution from @wookiehangover)
####0.0.1:
- Initial release with linechart, barchart and areachart follow in subsequent patch updates
Please help to support this project by hiring me for your next contract job. I do:
- custom d3 and/or React visualizations.
- React, AngularJS, or Backbone frontend work.
- backend work in Python(Flask, Django), Lua(w/Nginx), or Node.js, particularly REST APIs.
More at: ericbullington.com
MIT
Copyright (c) 2014-2015 Eric. S Bullington, Lim Yang Wei, and project contributors

