donut.js
Simple, cross-browser (VML+SVG) donut and pie charts generator
Usage
For CJS env the library is published as donutjs
npm install --save donutjs
const myDonutDiv = ; // returns div with donut
Options
el
(Node) -- a DOM node where donut should be placed (optional)data
(Array) -- array of objects (eg{value: 42, name: 'some name'}
)size
(Number) -- diameter of the donut (100 by default)weight
(Number) -- weight of arcs (size minus donut hole diameter) (20 by default)colors
(Array) -- list of colors (['#555']
by default)
const myDonut = ;
If options.weight === options.size/2
then you get a pie chart:
const myDonut = ;
Methods
setColor(arc, color)
-- sets arc colordata(arc[, data])
-- gets or sets data depending on second parameter existence
const arc = document; ; donut;