Y axis label not displaying large numbers - Multi-Bar Chart

末鹿安然 提交于 2019-12-07 08:52:40

问题


In my Multi-Bar Chart, I need to show larger numbers on the Y axis labels. Currently it's not showing more than seven characters:

How can I do it?


回答1:


Set chart.margin().left = 120 This will give you plenty of space to display 10,000,000.

nv.addGraph(function() {
  var chart = nv.models.discreteBarChart()
      .x(function(d) { return d.label })
      .y(function(d) { return d.value })
      .staggerLabels(true)
      .tooltips(false)
      .showValues(true)

  chart.forceY([10000000]);
  chart.margin().left = 120
  d3.select('#chart svg')
      .datum(data)
    .transition().duration(500)
      .call(chart);


  nv.utils.windowResize(chart.update);

  return chart;
});

JSFiddle: http://jsfiddle.net/marrok/Ev3UN/1/



来源:https://stackoverflow.com/questions/17297393/y-axis-label-not-displaying-large-numbers-multi-bar-chart

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