Skip to content Skip to sidebar Skip to footer

Add A Title To C3.js Chart Legend

I am using c3js and I'm still new to this chart framework. I need to set a title to the series legend of my chart. How can I do this? Do I need to use D3 to implement this? Thank

Solution 1:

How about this mess:

var firstLegend = d3.select(".c3-legend-item");
var legendCon = d3.select(firstLegend.node().parentNode);
var legendY = parseInt(firstLegend.select('text').attr('y'));
legendCon
  .append('text')
  .text('Legend Title')
  .attr('y', legendY - 20);

Post a Comment for "Add A Title To C3.js Chart Legend"