How can I get the max value of a y axis at highcharts?
y轴在海图上的最大值是多少?
i.e. 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. If you disable New York and Tokyo it is 20 and so on.
即http://jsfiddle.net/gh/get/jquery/1.7.2/highslide- softwarede / highcharts.com/tree/master/samples/highcharts/demots/demo/line -basic/这里的最大值是30。如果你禁用纽约和东京,它是20,等等。
Any ideas?
什么好主意吗?
2 个解决方案
#1
16
Assuming that chart
is your chart var.chart.yAxis[0].max;
假设该图表是您的图表var. chart. yaxis [0].max;
演示
Update
更新
@Anagio told that it's possible to get it the following way.chart.yAxis[0].getExtremes
@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.
通过这种方式,您可以获得数据值和滴答值。数据值是来自您的系列的值,而刻度值是来自图表行的值。
参考
#2
5
This information is directly accessible from a Axis
object. For example:
这些信息可以从Axis对象直接访问。例如:
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。getExtremes (API),但同样的数据也有:
-
Axis.min
: Min of the axis - 轴。最小值:轴的最小值
-
Axis.max
: Max of the axis - 轴。马克斯:轴的最大值。
-
Axis.dataMin
: Min of the data - 轴。数据民:数据的最小值
-
Axis.dataMax
: Max of the data - 轴。dataMax:数据的最大值
And even some historic data if the extremes of the axis has changed:
即使是一些历史数据如果轴的极值发生了变化:
-
Axis.oldMin
: The previous min of the axis - 轴。前边的最小值
-
Axis.oldMax
: The previous max of the axis - 轴。前一个轴的最大值
#1
16
Assuming that chart
is your chart var.chart.yAxis[0].max;
假设该图表是您的图表var. chart. yaxis [0].max;
演示
Update
更新
@Anagio told that it's possible to get it the following way.chart.yAxis[0].getExtremes
@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.
通过这种方式,您可以获得数据值和滴答值。数据值是来自您的系列的值,而刻度值是来自图表行的值。
参考
#2
5
This information is directly accessible from a Axis
object. For example:
这些信息可以从Axis对象直接访问。例如:
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。getExtremes (API),但同样的数据也有:
-
Axis.min
: Min of the axis - 轴。最小值:轴的最小值
-
Axis.max
: Max of the axis - 轴。马克斯:轴的最大值。
-
Axis.dataMin
: Min of the data - 轴。数据民:数据的最小值
-
Axis.dataMax
: Max of the data - 轴。dataMax:数据的最大值
And even some historic data if the extremes of the axis has changed:
即使是一些历史数据如果轴的极值发生了变化:
-
Axis.oldMin
: The previous min of the axis - 轴。前边的最小值
-
Axis.oldMax
: The previous max of the axis - 轴。前一个轴的最大值