简体   繁体   中英

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. 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/

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?

Taken from an answer here

Assuming that chart is your chart var.

chart.yAxis[0].max;

In addition to that the same works for the x axis:

chart.xAxis[0].max;

If the x axis is a collection of elements (for example month names) it outputs the number of elements - 1.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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