Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/381.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在highchart中的同步图表上悬停时线条淡出_Javascript_Jquery_Charts_Highcharts - Fatal编程技术网

Javascript 在highchart中的同步图表上悬停时线条淡出

Javascript 在highchart中的同步图表上悬停时线条淡出,javascript,jquery,charts,highcharts,Javascript,Jquery,Charts,Highcharts,我有两个不同容器的同步海图。我使用了一个脚本来同步图表。同步工作非常完美。我的第一张图表有三条线,第二张图表只有一条线 当我将鼠标悬停在第一个图表上时,第三行逐渐消失。当我 禁用脚本以进行同步—它工作正常 这是我的同步脚本 $('#container, #container2').bind('mousemove touchmove touchstart', function(e) { var chart, points, i, se

我有两个不同容器的同步海图。我使用了一个脚本来同步图表。同步工作非常完美。我的第一张图表有三条线,第二张图表只有一条线

当我将鼠标悬停在第一个图表上时,第三行逐渐消失。当我 禁用脚本以进行同步—它工作正常

这是我的同步脚本

$('#container, #container2').bind('mousemove touchmove touchstart', function(e) {
        var chart,
        points,
        i,
        secSeriesIndex = 1;

        for (i = 0; i < Highcharts.charts.length; i++) {
            chart = Highcharts.charts[i];
            e = chart.pointer.normalize(e); // Find coordinates within the chart
            points = [chart.series[0].searchPoint(e, true), chart.series[1].searchPoint(e, true)]; // Get the hovered point

            if (points[0] && points[1]) {
                if (!points[0].series.visible) {
                    points.shift();
                    secSeriesIndex = 0;
                }
                if (!points[secSeriesIndex].series.visible) {
                    points.splice(secSeriesIndex,1);
                }
                if (points.length) {
                    chart.tooltip.refresh(points); // Show the tooltip
                    chart.xAxis[0].drawCrosshair(e, points[0]); // Show the crosshair
                }
            }
        }
  });
$('#container,#container2').bind('mousemove touchtmove touchtstart',函数(e){
var图,
要点,,
我
secSeriesIndex=1;
对于(i=0;i


有人能帮我吗?

您需要将所有悬停点添加到
数组中,而不仅仅是前两个:

for (i = 0; i < Highcharts.charts.length; i++) {
    chart = Highcharts.charts[i];
    e = chart.pointer.normalize(e); // Find coordinates within the chart    
    points = [];

    chart.series.forEach(function(s) {
        points.push(s.searchPoint(e, true));
    });

    ...
}
for(i=0;i

现场演示:

您知道如何从范围导航器中删除工具提示吗?您好@hakkim,当然,您可以设置一个条件来防止从导航器中添加点: