将Highcharts的最大Y值设置为精确的数值而不舍入 [英] Setting Highcharts maximum Y value to an exact amount without rounding
问题描述
例如,如果我设置Y轴的最小值为0,最大值为3125,那么我会得到一个Y轴,从0开始,然后以500的增量上升到最大值3500,这根本不是我想要的。 p>
我可以让图表使用一个确切的最大值,还是总是以一种更奇怪的方式进行取整?
1)将您的tickInterval设置为一个数字,它平均分配到您的最大值
2)将'endOnTick'设置为false为您的y轴,并将您的maxPadding设置为0.这会将图表max设置为您的规格,而不管最后一次打勾下降。
http:// api。 highcharts.com/highcharts#yAxis.tickI nterval
http:/ /api.highcharts.com/highcharts#yAxis.maxPadding
http://api.highcharts.com/highcharts#yAxis.endOnTick
Every time I set my min and max values in Highcharts, I never get graphs with the exact min and max that I sent, but always something somewhat close. It seems as though Highcharts is picking a interval range for the axes and if my maximum doesn't conform to the right interval, it gets ignored or rounded off.
For example, if I set a min of 0 and a max of 3125 for a Y axis, I get a Y axis starting with 0 then going up in increments of 500 to a maximum of 3500, which is not at all what I want.
Can I get the chart to use an exact maximum or will it always round up in some wierd way?
There are a couple of things that you can do.
1) set your tickInterval to a number that divides evenly into your max
2) set 'endOnTick' to false for your y axis, and set your maxPadding to 0. This will set the chart max to your specification, regardless of where the last tick falls.
http://api.highcharts.com/highcharts#yAxis.tickInterval
http://api.highcharts.com/highcharts#yAxis.maxPadding
http://api.highcharts.com/highcharts#yAxis.endOnTick
这篇关于将Highcharts的最大Y值设置为精确的数值而不舍入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!