D3 shows a number instead of percent on a pie chart

I draw a graph to show how many people filled our application and how many people did not go through all the stages. For this, my company decided to use the d3 library to display diagrams. However, in the pie chart, they want to show the whole number instead of the default percentage, and I can not find any documentation on this.

My code for this looks like

c3.generate({ bindto: '.pieChart', data: { columns: [ ['Started', Started], ['Completed', Completed] ], type: 'pie' } }); 

Any help would be appreciated!

+6
source share
1 answer

The documentation is pretty good to clean up .

 var chart = c3.generate({ data: { columns: [ ['data1', 30], ['data2', 50] ], type: 'pie' }, pie: { label: { format: function(value, ratio, id) { return value; } } } }); 

An example is here .

+15
source

Source: https://habr.com/ru/post/988402/


All Articles