Chartist-js: Label Text Centered in Donut Chart

Created on 4 Apr 2015  路  7Comments  路  Source: gionkunz/chartist-js

Hey--

I've been fiddling around with the various options and interpolation, but I cannot seem to get the label text to stay centered in the middle of the donut chart. I can get a position that passes for centered, but the position of the text changes and the donut chart values change.

How do I place a label in the absolute center of a donut chart?

screen shot 2015-04-04 at 21 48 43

Most helpful comment

Hi, I've updated the bin http://jsbin.com/buhoza/2/edit?css,js,output

All 7 comments

Hi there. You need to use a combination of Styling and the Chartist Draw events:

http://jsbin.com/buhoza/1/edit?css,js,output

Closing this for now, please comment if you need anything else.

The above shown jsbin does not work :( I'm trying to work this solution out but it seems to be related to new version of Chartist. Could someone help me out here? ( @gionkunz )

I found out playing around labelOffset, labelDirection and labelPosition might do the trick. But still no luck. Anyone care to help please?

Hi, I've updated the bin http://jsbin.com/buhoza/2/edit?css,js,output

Thank you for the bin! It's perfect if you don't want to show a label for each of the slices. Is there a possibility to add a new label like that while keeping the labels corresponding to each slice?

Hey it's may be too late but it can help the other person . I was inspired by @gionkunz 's jsbin for that donut who displays the percentage of each value when we mouse over a slice. Hope i can help someone :) https://jsfiddle.net/k9mw7x9q/2/

(sorry for my English, it's not my native language)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pathtoknowhere picture pathtoknowhere  路  4Comments

pjfsilva picture pjfsilva  路  4Comments

denisvolokh picture denisvolokh  路  4Comments

jbwl picture jbwl  路  4Comments

imkevinabraham picture imkevinabraham  路  3Comments