2.0.0 • Published 6 years ago

react-d3kit v2.0.0

Weekly downloads
7
License
Apache-2.0
Repository
github
Last release
6 years ago

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

2.0.0

6 years ago

0.0.2

7 years ago

1.2.4

7 years ago

1.2.3

7 years ago

1.2.2

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.0

8 years ago

1.0.0

8 years ago

0.0.1

8 years ago