如何以编程方式设置选择Highchats主细节图表?

编程入门 行业动态 更新时间:2024-10-26 10:38:45
本文介绍了如何以编程方式设置选择Highchats主细节图表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我已根据Highcharts文档和此示例创建了自己的主从明细表:www.highcharts/demo/dynamic-master-detail

I have created my own master-detail chart following the Highcharts docs and this example: www.highcharts/demo/dynamic-master-detail

一切正常,但我想添加一个功能:加载图表时,应在主图表中自动选择最后50个数据点,并在详细图表中显示.

Eveything works fine but I would like to add a feature: When the chart is loaded the last 50 data points should automatically be selected in the master chart and thus shown in the detail chart.

我试图手动触发选择事件,但是没有成功.知道如何解决这个问题吗?

I tried to manually trigger the selection event but it did not work out. Any idea how to solve this?

推荐答案

您可以在图表加载事件中触发 selection 事件并设置正确的极限值:

You can fire selection event in chart load event and set correct extremes:

chart: { ... events: { load: function() { var points = this.series[0].points, xAxis = this.xAxis[0]; Highcharts.fireEvent(this, 'selection', { xAxis: [{ min: points[points.length - 51].x, max: points[points.length - 1].x }], }); }, selection: function(event) { ... } } }

实时演示: jsfiddle/BlackLabel/xy8qug9h/

API: api.highcharts/highcharts/chart.events.load

更多推荐

如何以编程方式设置选择Highchats主细节图表?

本文发布于:2023-11-23 01:47:06,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1619671.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:图表   细节   方式   Highchats

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!