简体   繁体   中英

x-axis tick is not incremented correctly and it is set to the max value of y

I am working on MultiBarHorizontalChart() using nvd3.js. I see that in this example http://nvd3.org/examples/multiBarHorizontal.html , y-axis ticks are not incremented correctly. Increment value is 5 in this graph, how can I configure the chart not to display 25.31

You can use d3 to format the values to no decimal places, although this doesn't work on the nvd3 live code website, it does work when you do it on your website.

Add the following code to your script.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM