Monday 26 July 2021

Create custom tooltip data C3 pie chart

Im trying to create a detailed tooltip on C3 pie chart (source), here my starting code :

var chart = c3.generate({
     data: {
         columns: [
             ['Error', 72,15,11],
             ['Success', 58,42,5],
        ],
        type : 'pie'
     },
     tooltip: {
         format: {
             title: function (d) { return 'Data ' + d; },
             name : function(name) { return  name; }
         }
     } 
});

Here what i want to display : Pie with detailed tooltip

I Tried with an array in data with no-success

 columns: [
        ['Error': {name : 'Stage 1', value : 72},{name : 'Stage 2', value : 15},{name : 'Stage 3', value : 11}],
        ['Success': {name : 'Stage 1', value : 58},{name : 'Stage 2', value : 42},{name : 'Stage 3', value : 5}],
    ],

Here my JSFiddle



from Create custom tooltip data C3 pie chart

No comments:

Post a Comment