Easily convert d3Kit chart into React component


License
Apache-2.0
Install
npm install react-d3kit@2.0.0

Documentation

Introduction | Demo

react-d3kit NPM version Build Status Dependency Status

Easily convert d3Kit chart into React component

Install

npm install react-d3kit --save

or

bower install react-d3kit --save

Example Usage

Basic

// When PlainBubbleChart is a reusable chart written in d3Kit.
const BubbleChart = ReactD3Kit.createComponent(PlainBubbleChart);

ReactDOM.render(
  <BubbleChart data={data} options={options} />,
  document.getElementById('app')
);

With auto-resize

You can pass props fitOptions and watch, which is equivalent to calling d3Kit's chart.fit(fitOptions, watch). See documentation here.

// When PlainBubbleChart is a reusable chart written in d3Kit.
const BubbleChart = ReactD3Kit.createComponent(PlainBubbleChart);

const fitOptions = { width: '100%', height: 400 };

ReactDOM.render(
  <BubbleChart
    data={data}
    options={options}
    fitOptions={fitOptions}
    watch={true}
  />,
  document.getElementById('app')
);

See demo source

Import into your project

Choice 1. Global

Adding this library via <script> tag is the simplest way. By doing this, ReactD3Kit is available in the global scope.

<script src="bower_components/react-d3kit/dist/react-d3kit.min.js"></script>
Choice 2: AMD

If you use requirejs, this library support AMD out of the box.

require.config({
  paths: {
    'react-d3kit': 'path/to/react-d3kit'
  }
});
require(['react-d3kit'], function(ReactD3Kit) {
  // do something with reactD3Kit
});
Choice 3: node.js / browserify

This library also supports usage in commonjs style.

const ReactD3Kit = require('react-d3kit');
Choice 4: ES6 Import
import { createComponent } from 'react-d3kit';

License

© 2016 Krist Wongsuphasawat (@kristw) Apache-2.0 License