简体   繁体   English

如何在高图中获得yAxis标签的最高价值?

[英]How can I get the top value of the yAxis labels in highcharts?

Let say we have this set of data: 假设我们有以下数据集:

var data = [10, 20, 15, 40, 30, 25];

With highcharts, the maximum value of the yAxis would be 50 or something. 使用高图时,yAxis的最大值将为50左右。 Here's the basic example from their site: http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/demo/column-basic/ 这是他们网站上的基本示例: http : //jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/demo/column-basic/

My question is. 我的问题是。 How can I get the number 50 (in my case) and number 250 in their example in a javascript variable so I can write logic based on that? 如何在javascript变量中获取数字50(以我的情况为例)和数字250(在我的示例中),以便我可以基于此编写逻辑?

Taken from an answer here 取自这里的答案

Assuming that chart is your chart var. 假设该chart是您的图表变量。

chart.yAxis[0].max;

In addition to that the same works for the x axis: 除此之外,x轴也适用:

chart.xAxis[0].max;

If the x axis is a collection of elements (for example month names) it outputs the number of elements - 1. 如果x轴是元素的集合(例如月份名称),则输出元素的数量-1。

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

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