Highcharts - manually trigger hover event on a point

前端 未结 4 1819
醉话见心
醉话见心 2020-12-13 21:06

When you hover over a point in a Highcharts chart, you get a nice enlarged circle under you cursor (or other symbol). What I would like to do manually trigger that hover eff

4条回答
  •  再見小時候
    2020-12-13 21:39

    Here is an example of how to select (hover) the last valid point in series programmatically:

      // Find last not-null point in data
      let last = data.indexOf(null) - 1;
      last = (last === -2) ? data.length - 1 : last;
      const lastPoint = this.series[0].points[last];
    
      // Trigger the hover event 
      lastPoint.setState('hover');
      lastPoint.state = '';  // You need this to fix hover bug
      this.tooltip.refresh(lastPoint); // Show tooltip
    

    Full JSFiddle exapmle

提交回复
热议问题