【问题标题】:x-axis tick is not incremented correctly and it is set to the max value of yx 轴刻度未正确递增,并设置为 y 的最大值
【发布时间】:2014-12-11 21:16:32
【问题描述】:

我正在使用 nvd3.js 开发 MultiBarHorizo​​ntalChart()。我看到在这个例子中http://nvd3.org/examples/multiBarHorizontal.html,y 轴刻度没有正确增加。该图中的增量值为 5,如何配置图表不显示 25.31

【问题讨论】:

    标签: javascript d3.js charts nvd3.js


    【解决方案1】:

    您可以使用 d3 将值格式化为无小数位,尽管这在 nvd3 实时代码网站上不起作用,但在您的网站上执行时它确实有效。

    将以下代码添加到您的脚本中。

      chart.yAxis
      .tickFormat(d3.format(',0f'));
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-05-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-19
      • 1970-01-01
      相关资源
      最近更新 更多