GithubHelp home page GithubHelp logo

d3by5-pie-chart's Introduction

d3by5-pie-chart

The d3by5 is part of the d3by5 graph tools, this specific package will draw a pie chart based on Mike Bostocks Towards Reusable Charts using d3 v4.0

NOTE

This is an internal project, you are probably better off using somethin like C3. That said, just give it a try and contact us back (no capslock please).

USAGE

NPM

Build the project by running

npm run build

When building two versions are built in the dist folder. use the [version] version if you want to keep a specific version, use submodules or symlinks (or download) of the one without version if you want to update the lib without updating your code.

Requirejs

Just require the sourcefile, it expects the following files accessible at root so you may have to add a shim for it

  • d3by5-base-chart
  • d3by5-transitions
  • d3 - v3x
  • underscore

dist/

A browserified and uglified version with all dependencies included. Use this if you only want a simple graph to test.

  • pie-chart-[version].min.js // uglified and minified with version
  • pie-chart.min.js // uglified and minified without version

DEPENDENCIES

Two dependencies in package.json

  • Underscore
  • d3
npm install

will get you all you need

API

Required

  • width - Number: the height of the chart
  • height - Number: the width of the chart
  • data - Array: the data that produces the chart, [{label: String, value: Number}, {xx}]

Optional

  • fillColor - String/hex: the fillcolor (defaults to 'coral')
  • padding - Number: the padding to use (detaults to 2)

EXAMPLE

All methods are chained, you can simply instanciate a new pie chart like this

var pie = require('d3by5-pie-chart');

var piechart = piechart()
                    .width(500)
                    .height(400)
                    .data([{label:'coffee', values: 509}, {label:'tea', values: 1}]);

d3.select('.js-pie-chart')
    .call(piechart);

LICENCE

MIT

d3by5-pie-chart's People

Contributors

bardrotzer avatar svale avatar

Watchers

James Cloos avatar  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.