将Highcharts的最大Y值设置为精确的数值而不舍入 [英] Setting Highcharts maximum Y value to an exact amount without rounding

查看:134
本文介绍了将Highcharts的最大Y值设置为精确的数值而不舍入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每次我在Highcharts中设置我的最小值和最大值时,我从来没有得到具有我发送的确切最小值和最大值的图表,但总是有点接近。看起来好像Highcharts正在为坐标轴选择间隔范围,如果我的最大值不符合正确的间隔,它会被忽略或舍入。

例如

例如,如果我设置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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆