以编程方式启动Highcharts缩放(选择后) [英] Launch Highcharts zooming programmatically (after a selection)

查看:124
本文介绍了以编程方式启动Highcharts缩放(选择后)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的图表的xAxis以天(xAxisType = dateTime)表示。我修改选择事件(缩放)并取决于天数在选择中选择,图表数据将被重新计算并且xAxis会更改为小时(而不是几天)。如果我们在新图表中进行另一次选择(数据重新计算和xAxis更改为十分钟而不是几小时),则会发生同样的过程。



想象一下,我们有来自图表中2月1日至2月25日。如果我们选择2月2日和3日,新的重新计算的数据会在xAxis中显示几小时(现在我们已在xAxis中从2月2日00:00至2月3日23:00,48次)。如果我们再次选择新的时间段(例如从2月2日的7:00到2月2日的10:00),新的重新计算的数据会显示出来,但xAxis会显示10分钟的时间。重要的是关于最后一件事,整天都显示出来(24小时不到10分钟),不仅仅是选定的时间段。



问题是,是吗?在上次选择之后(以编程方式),选择期间(从2月2日07:00至2月10日10:00)发布常规Highcharts缩放的任何方式?



有了这个,直接出现在选定的时期,而不是整天,我有机会推动按钮重置变焦,并获得一整天(我现在有的)。



我在Dojo中使用Highcharts。

解决方案

设置极值使用:

  this.xAxis [0] .setExtremes(min,max); 
this.showResetZoom();


The xAxis of my charts is represented with days (xAxisType=dateTime).

I modify the selection event (zooming) and depend on the amount of days which are selected in the selection, the chart data is recalculated and the xAxis change to hours (instead of days). And the same process happens if we do another selection in the new chart (data recalculation and xAxis change to ten minutes, instead of hours).

Imagine that we have dates from 1st of February to 25th of February in the chart. If we select the 2nd and 3rd of February, the new recalculated data is shown with hours in the xAxis (now we have in the xAxis from 2nd February 00:00 to 3rd February 23:00, 48 ticks). And if we select again a new period (for example from 2nd February 07:00 to 2nd February 10:00) the new recalculated data is shown but in the xAxis appear ten minutes ticks. Important about this last thing, all the day is shown (24 hours divided in ten minutes ticks) not only the selected period.

The question is, is it any way of launching the regular Highcharts zooming with the selected period (from 2nd February 07:00 to 2nd February 10:00) after this last selection (programmatically)?

With this, appears directly the selected period instead the whole day, and I have the chance to push the button "reset the zoom" and get the whole day (what I have now).

I use Highcharts with Dojo.

解决方案

To set extremes use:

this.xAxis[0].setExtremes(min,max);
this.showResetZoom();

这篇关于以编程方式启动Highcharts缩放(选择后)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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