c3 icon indicating copy to clipboard operation
c3 copied to clipboard

Change donut title (Interior text) dynamically with chart loads

Open kethomassen opened this issue 10 years ago • 4 comments

Is there a way to make the title inside the donut chart change to the sum of all the data values, updating automatically with every data load into the chart?

kethomassen avatar Sep 21 '15 02:09 kethomassen

You can use this to change the title dynamically. d3.select('#div_id .c3-chart-arcs-title').node().innerHTML = "new title";

where div_id is the id of the div to which your chart is bounded. you may have to write the logic to calculate sum on your own

vishal-kony avatar Nov 19 '15 10:11 vishal-kony

and how can we change font and color dynamically?

asadchachar avatar May 23 '17 12:05 asadchachar

I was able to do it following vishal-kony's advice. However it will be better if c3 library provides an API for this. Something like chart.updateTitle('donut','new title');

AfzalH avatar Sep 28 '17 09:09 AfzalH

Any update?

mpushki avatar Apr 21 '21 08:04 mpushki