【问题标题】:Add a title to C3.js chart legend为 C3.js 图表图例添加标题
【发布时间】:2015-03-30 06:18:48
【问题描述】:

我正在使用 c3js,但我还是这个图表框架的新手。我需要为图表的系列图例设置标题。我怎样才能做到这一点?我需要使用 D3 来实现吗?

提前致谢。

【问题讨论】:

    标签: javascript d3.js c3.js


    【解决方案1】:

    这个烂摊子怎么样:

    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);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-11-08
      • 2018-03-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多