13

I'm drawing a graph to show how many people completed our app and how many people failed going through all the steps. To do this my company has decided to use the library d3 to show the charts. However, on the pie chart they want a whole number to show instead of the default percentage and I can't seem to find any documentation on this.

My code for this looks like this

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

Any help would be appreciated!

Lars Kotthoff
  • 107,425
  • 16
  • 204
  • 204
zazvorniki
  • 3,512
  • 21
  • 74
  • 122

1 Answers1

25

The documentation is pretty clear.

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

Example here.

Mark
  • 106,305
  • 20
  • 172
  • 230