如何以编程方式放大highcharts? [英] How to programmatically zoom in highcharts?

查看:160
本文介绍了如何以编程方式放大highcharts?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

调用axis.setExtremes()或axis.zoom()时,关联的缩放按钮不会突出显示。



例如,



有没有简单的方法来完成这个?



对于更多的上下文:我想做我的应用程序,所以如果你查看一个图形,缩放,然后离开图表,并再回到它,我想恢复你的'缩放级别'。



我基本上是通过监听afterSetExtremes并存储最大/最小值,然后在图上调用'zoom'用户返回。



如果有一个更简单的方法来完成这个,我会很好。


解决方案

您也可以在按钮上调用setState。



http://jsfiddle.net/W56P5/2/

  chart.rangeSelector.buttons [3] .setState(2); 


When calling axis.setExtremes() or axis.zoom(), the associated zoom button does not become highlighted.

For example, if I programatically 'zoom' to 1-hour, I would like the '1 hour' zoom button to appear as 'pressed'.

Is there a simple way to accomplish this?

For more context: I want to make my app stately, so that if you view a graph, zoom, then navigate away from the graph and back to it again, I want to restore your 'zoom level'.

I have this basically working by listening for afterSetExtremes and storing the max/min values, and then using those to call 'zoom' on the graph when the user returns.

If there is a simpler way to accomplish this, I'd be fine with that.

Thanks for any direction!

解决方案

You can also call setState on the button.

http://jsfiddle.net/W56P5/2/

chart.rangeSelector.buttons[3].setState(2);

这篇关于如何以编程方式放大highcharts?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆