It would be great, if there were a possibility to show the absolute values and not the calculated percentages on donut charts. I would really appreciate it! :)
Why was this request closed?
Because you can change it like this:
var chart = c3.generate({
bindto: '#chart',
data: {
columns: chartData,
type : 'donut'
},
color: {
pattern: ['#AACCB1', '#D4D6D9']
},
donut: {
label: {
format: function (value) { return value; }
}
}
});
:+1:
Thanks
Thanks @gopeter , saved my days! That answer should be on documentation! :)
@gopeter Can you please advice I get the below error when I try to display absolute values and not the calculated percentages on donut charts:
Argument of type '{ bindto: string; size: { height: number; width: number; }; color: { pattern: string[...' is not assignable to parameter of type 'ChartConfiguration'.
Types of property 'donut' are incompatible.
Type '{ label: { format: (value: number) => number; }; }' is not assignable to type '{ label?: { show?: boolean; format?(value: number, ratio: number, id: string): string; threshold?...'.
Types of property 'label' are incompatible.
Type '{ format: (value: number) => number; }' is not assignable to type '{ show?: boolean; format?(value: number, ratio: number, id: string): string; threshold?: number; }'.
Types of property 'format' are incompatible.
Type '(value: number) => number' is not assignable to type '(value: number, ratio: number, id: string) => string'.
Type 'number' is not assignable to type 'string'.
Error: Types of property 'format' are incompatible.
Type '(value: number) => number' is not assignable to type '(value: number, ratio: number, id: string) => string'.
Type 'number' is not assignable to type 'string'.
Most helpful comment
Because you can change it like this: