C3: Show absolute data (no percent values) on donut charts

Created on 28 Apr 2014  路  6Comments  路  Source: c3js/c3

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! :)

Most helpful comment

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

All 6 comments

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'.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wojciechowskid picture wojciechowskid  路  3Comments

kethomassen picture kethomassen  路  3Comments

aishwaryak picture aishwaryak  路  4Comments

Zerim picture Zerim  路  3Comments

seubert picture seubert  路  3Comments