向C3.js图表图例添加标题 [英] Add a title to C3.js chart legend
本文介绍了向C3.js图表图例添加标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用c3js,我还是新的这个图表框架。我需要为我的图表的系列图例设置一个标题。我如何做到这一点?我需要使用D3来实现这一点吗?
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?
提前感谢。
推荐答案
这种混乱:
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);
这篇关于向C3.js图表图例添加标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文