mytPieChart
v1.0.1
Published
"Library that simplifys the use of d3 to display pie charts."
Maintainers
Readme
myt-pie-chart
Simple pie chart library with D3
How to use:
include scripts/d3.js and scripts/mytPieChart.js
create a new instance of the pie chart as example below
var pie = mytPieChart.newChart();
set pie data with pie.setData(data)
data format: [{ name: string, value: int, bgColor: string, color: string }]
name & value are required, bgColor has calculated default value and color has 'black' default value
set width with pie.setWidth(int)
set height with pie.setHeight(int)
set containerId with pie.setContainerId(string)
ContainerID must be passed else the chart won't display properly.
(ID of an existing element that the chart will be displayed in)
set chart id with pie.setId(string)
Id required for proper display of tooltips.
(A string that will be used to identify svg and tooltip elements)
display the chart with pie.draw()
if you want to redraw the chart simply call pie.draw() again
examples are inside index.html
