问题
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.
回答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);
来源:https://stackoverflow.com/questions/28241553/add-a-title-to-c3-js-chart-legend