Reputation: 1046
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?
Thanks in advance.
Upvotes: 1
Views: 2719
Reputation: 108507
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);
Upvotes: 4