从远程元素突出显示Highcharts系列 [英] Highlighting Highcharts series from a remote element

查看:101
本文介绍了从远程元素突出显示Highcharts系列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图弄清楚如何从与Chart对象无关的元素中突出显示Highcharts中的一行(系列)。



I通过文档,并没有真正看到实现这一目标的方式。我可以使用 series.get(id)来进入系列元素。



好像没有方法这可能会有所帮助 - http://www.highcharts.com/ref/#series-object

任何想法如果甚至可能的话? 经过大量的挖掘和测试,我已经设法得到这个工作 - 仍然不知道这是最好的方式(可能不是)。
$ b $

Chart.series.get(someId).graph.attr('stroke-width','5')



只是进入实际DOM元素并更改单个元素的属性值,所以如果您需要更改笔触宽度以及此行上标记的样式,则必须遍历所有元素,并手动应用更改。



更新:好的,还有一种更好的方法

但这就是我们如果库改变了你的代码,你的代码将不起作用:
$ b $ p code Chart.series.get(someId).onMouseOver( )和 Chart.series.get(someId).onMouseOut()



这实际上激发了定义的悬停状态。


I'm trying to figure out how to highlight a line (series) in Highcharts from an element that's not related to the Chart object in any way.

I went through the documentation, and don't really see a way of achieving this. I can get into the series elements using the series.get(id).

Seems like there are no methods that can be helpful - http://www.highcharts.com/ref/#series-object

Any ideas if that's even possible?

解决方案

After a lot of digging and testing, I've managed to get this working - still not sure if this is the best way (probably not).

Chart.series.get(someId).graph.attr('stroke-width', '5')

Unfortunately, this is just getting into the actual DOM element and changing the value of the property of a single element, so if you need to change the stroke width, and the styles of the markers on this line, you'd have to loop through all elements, and apply changes manually.

UPDATE: Ok, there's a better way

But this is using the private API, so if the library changes thins, your code will not work:

Chart.series.get(someId).onMouseOver() and Chart.series.get(someId).onMouseOut().

This actually fires the defined hover-state.

这篇关于从远程元素突出显示Highcharts系列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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