简体   繁体   English

如何设置Highcharts图表最大yAxis值

[英]How to set Highcharts chart maximum yAxis value

I've been trying for two days to find a way to set the maximum value of 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 WG 在此先感谢Bruno WG

Try this: 试试这个:

yAxis: {min: 0, max: 100}

See this jsfiddle example 看到这个jsfiddle示例

Alternatively one can use the setExtremes method also, 或者,也可以使用setExtremes方法,

yAxis.setExtremes(0, 100);

Or if only one value is needed to be set, just leave other as null 或者,如果只需要设置一个值,则将其他值保留为null

yAxis.setExtremes(null, 100);

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;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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