javascript - How to create a donut chart like this in chart.js -


enter image description here

i not able put text 15% or 16% in graph. s there way it.

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.

    enter image description here


Comments

Popular posts from this blog

Sass watch command compiles .scss files before full sftp upload -

filehandler - java open files not cleaned, even when the process is killed -

gridview - Yii2 DataPorivider $totalSum for a column -