Code Monkey home page Code Monkey logo

react-d3kit's Introduction

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

react-d3kit's People

Contributors

kristw avatar npmcdn-to-unpkg-bot avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.