javascript - How to create a donut chart like this in chart.js -
since chart generation has changed lot chart 1.x (docs) 2.x (docs), depend on version using project :
version 1.x
not available doughnut charts
if working pie charts, built in in data passing chart.
see this jsfiddle more information , full result.
version 2.x
two methods :
you can create new chart type using
.extend()
method.then during creation of new type, draw percentage in section.
check this jsfiddle see result (better first version, imho).you can force tooltip enabled (as asked in this other question).
you have edit displayed in tooltip put percentage instead of value. , move (edit
x
,y
positions) tooltip appear should be.the image displays pie chart, can make work doughnut.
Comments
Post a Comment