Add a title to C3.js chart legend

我们两清 提交于 2019-12-11 13:58:40

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!