Reusable donut chart module for DIY.
JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples
.gitignore
.jshintrc
index.js
license.txt
package.json
readme.md

readme.md

diy-donutchart

Render a donut chart using d3.

view on requirebin

example

Let's render a donut chart! MMMM!

var donutchart = require('diy-donutchart');

var target = document.getElementById('donut-chart');

var data = {
    percent: 0.2
};

var options = {
    color: '#34a2d8',
    size: 160,
    thickness: 20
};

donutchart(target, data, options);

methods

var donutchart = require('diy-donutchart');

donutchart($el, data, [options])

Appends a svg element to $el.

$el is the target element. data should be an object with a percent property.

Options can contain:

color of the positive ring (background is light gray).

size is the width and height of the donut.

thickness adjusts the thickness of the donut ring.

{
    color: '#34a2d8',
    size: 160,
    thickness: 20
}

license

APACHE 2.0