6

toke it from c3 official page

In this case I would like to show 180 instead of 0 on tooltip title. I know that it can be customized like it is done in c3 official documentation. But I don't find the way to get the total per column.

AlexLarra
  • 841
  • 5
  • 18

1 Answers1

7

Just write your own tooltip contents function

tooltip: {
    contents: function (d, defaultTitleFormat, defaultValueFormat, color) {
        var sum = 0;
        d.forEach(function (e) {
            sum += e.value
        })
        defaultTitleFormat = function () {
            return sum
        };
        return c3.chart.internal.fn.getTooltipContent.apply(this, arguments);
    }
}

Fiddle - http://jsfiddle.net/x0b3w32e/

potatopeelings
  • 40,709
  • 7
  • 95
  • 119