Javascript 如何设置 Highcharts 图表最大 yAxis 值

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6847244/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 23:26:33  来源:igfitidea点击:

How to set Highcharts chart maximum yAxis value

javascripthighcharts

提问by bwagner

I've been trying for two days to find a way to set the maximum valueof the yAxis on Highcharts.

我已经尝试了两天来找到一种方法来设置Highcharts 上 yAxis的最大值

I got a percentage column graphic, but the highest value in the series is 60, so it adjusts the axis to top at 70, I found a way to choose the start point, but no way to choose the end point.

我得到了一个百分比柱形图,但该系列中的最高值是 60,因此它将轴调整到70 的顶部,我找到了选择起点的方法,但没有选择终点的方法

What I really need is to set the yAxis from 0 to 100, so the data will be more accurately viewed as percentage

我真正需要的是将yAxis 从 0设置为 100,以便将数据更准确地视为百分比

Thanks in advance, Bruno W.G.

提前致谢,布鲁诺 WG

回答by Peter

Try this:

尝试这个:

yAxis: {min: 0, max: 100}

See this jsfiddleexample

这个 jsfiddle例子

回答by Gayan Dasanayake

Alternatively one can use the setExtremesmethod also,

或者,也可以使用setExtremes方法,

yAxis.setExtremes(0, 100);

Or if only one value is needed to be set, just leave other as null

或者如果只需要设置一个值,只需将其他值保留为空

yAxis.setExtremes(null, 100);

回答by MANISH ZOPE

Taking help from above answer link mentioned in the above answer sets the max value with option

从上述答案中提到的上述答案链接中获取帮助,使用选项设置最大值

yAxis: { max: 100 },

On similar line min value can be set.So if you want to set min-max value then

在类似的行上可以设置最小值。所以如果你想设置最小值-最大值那么

yAxis: {
   min: 0,     
   max: 100
},

If you are using HighRoller php library for integration if Highchart graphs then you just need to set the option

如果您使用 HighRoller php 库进行 Highchart 图形集成,那么您只需要设置选项

$series->yAxis->min=0;
$series->yAxis->max=100;