Highcharts:在一个点上设置'选择'状态并在鼠标悬停后保持它? [英] Highcharts: set 'select' state on a point and maintain it after mouseover?

查看:396
本文介绍了Highcharts:在一个点上设置'选择'状态并在鼠标悬停后保持它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Highcharts并试图在一个点上设置选择状态并保持状态。



我可以设置状态,就像这样:

  var chart = new Highcharts.Chart(options); 
chart.get('b')。setState('select');

但是当用户将鼠标悬停在点上时,状态会变得不确定。



下面是一个JSFiddle示例 - 尝试将鼠标悬停在红点上并观察它丢失了选择状态:< a href =http://jsfiddle.net/o72xgtfm/1/ =nofollow> http://jsfiddle.net/o72xgtfm/1/

即使在鼠标悬停之后,状态也不应该维持,因为它是 select 状态,而不是 hover



我只想将点设置为红色,并将其保持为红色。我可以设置一个不受mouseover影响的自定义状态吗?

解决方案

我最终设法解决了这个问题:

  point.select(true,true); 

而非

  point.setState( '选择'); 

后者没有记录,而第一个似乎是官方的做法。

I'm using Highcharts and trying to set the select state on a point and maintain the state.

I can set the state just fine, like this:

var chart = new Highcharts.Chart(options);
chart.get('b').setState('select');

But the state gets unset when the user mouses over and then out of the point.

Here is a JSFiddle example - try mousing over the red point and observe that it loses its select state: http://jsfiddle.net/o72xgtfm/1/

Shouldn't the state be maintained even after mouseover, given that it's a select state, not hover?

All I want is to set the point as red, and keep it red. Could I perhaps set a custom state that wouldn't be affected by mouseover?

解决方案

I managed to fix this eventually by using:

point.select(true, true);

rather than

point.setState('select');

The latter is undocumented, whereas the first seems to be the official way to do things.

这篇关于Highcharts:在一个点上设置'选择'状态并在鼠标悬停后保持它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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