C3: Change donut title (Interior text) dynamically with chart loads

Created on 21 Sep 2015  路  3Comments  路  Source: c3js/c3

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?

Most helpful comment

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');

All 3 comments

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

and how can we change font and color dynamically?

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');

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wojciechowskid picture wojciechowskid  路  3Comments

Zerim picture Zerim  路  3Comments

Saikat-Sinha picture Saikat-Sinha  路  3Comments

laurentdebricon picture laurentdebricon  路  3Comments

seubert picture seubert  路  3Comments