简体   繁体   English

如何在高位图中获得y轴的最大值?

[英]How can I get the max value of a y axis at highcharts?

How can I get the max value of ay axis at highcharts? 如何在highcharts中获取ay轴的最大值?

ie http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/demo/line-basic/ here max value is 30 . http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/demo/line-basic/这里最大值为30 If you disable New York and Tokyo it is 20 and so on. 如果禁用纽约和东京则为20 ,依此类推。

Any ideas? 有任何想法吗?

Assuming that chart is your chart var. 假设chart是你的图表var。
chart.yAxis[0].max;

demo 演示

Update 更新

@Anagio told that it's possible to get it the following way. @Anagio告诉我们可以通过以下方式获得它。
chart.yAxis[0].getExtremes

This way you can get the data values and the tick values. 这样您就可以获得数据值和刻度值。
The data values are the values from your series, while the tick values are the values from chart lines. 数据值是系列中的值,而刻度值是图表行中的值。

Reference 参考

This information is directly accessible from a Axis object. 可以从Axis对象直接访问此信息。 For example: 例如:

var chart = $('#container').highcharts();
var axisMax = chart.yAxis[0].max; // Max of the axis
var dataMax = chart.yAxis[0].dataMax; // Max of the data

As mentioned you can use Axis.getExtremes ( API ) , but the same data is also available as: 如前所述,您可以使用Axis.getExtremesAPI ),但同样的数据也可用作:

  • Axis.min : Min of the axis Axis.min :轴的最小值
  • Axis.max : Max of the axis Axis.max :轴的最大值
  • Axis.dataMin : Min of the data Axis.dataMin :数据的最小值
  • Axis.dataMax : Max of the data Axis.dataMax :数据的最大值

And even some historic data if the extremes of the axis has changed: 如果轴的极端发生了变化,甚至还有一些历史数据:

  • Axis.oldMin : The previous min of the axis Axis.oldMin :轴的前一个最小值
  • Axis.oldMax : The previous max of the axis Axis.oldMax :轴的先前最大值

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

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