有问题的突出显示(悬停)一个系列,突出显示图表

Problematically highlight(hover) a serie ,highcharts

本文关键字:个系列 显示图 悬停 显示 有问题      更新时间:2023-09-26

>假设我在剧情之外有一个系列名称的列表,当我将鼠标悬停在其中一个时,我想将其中一个系列突出显示(悬停)。

这是在渲染绘图之后

我怎样才能实现这一点(我也在使用jQuery)

感谢@Pawe ł Fus的帮助。最后,我用下面的方法来解决这个问题。由于我的系列数组中没有 id,因此我使用 $each() 来比较名称

        var chart = $plotResult.highcharts();//get the chart object
        var highlightSerieCallback = function(e){//mouse in callback
            var seriesName = $(this).find(':first-child').text();
            console.log('serieName hightLight',seriesName);
            $.each(chart.series, function(i, s) {
                if(s.name == seriesName){
                    s.onMouseOver();
                    return false;//break the each
                }
            });
        };
        var disHighlightSerieCallback = function(e){//mouse leave callback
            var seriesName = $(this).find(':first-child').text();
            console.log('serieName DisHightLight',seriesName);
            $.each(chart.series, function(i, s) {
                if(s.name == seriesName){
                    s.onMouseOut();
                    return false;//break the each
                }
            });
    };
        $sumAndAvgResultWrap.find('tr:not(:first-child)').hover(highlightSerieCallback,disHighlightSerieCallback);//bind the callback