高图表禁用点光晕动画

时间:2017-08-07 22:13:36

标签: javascript highcharts

我已经修改了用于处理工具提示显示的事件,其中我已同步两个图表,而一个图表不包含与另一个图表相同数量的数据点。

请参阅JSFiddle,特别是当8/5和8/8的数据点悬停时的顶部图表。这些积分不再突出显示,但在短暂的一段时间内,“光环”会消失。动画显示。我想防止每个点的光环对用户可见。

$('#success-graphs-container').bind('mousemove touchmove touchstart', function(e) {
  var charts = Highcharts.charts.filter(function(chart) {
    return (chart.title.textStr.match(/success/i)) ? chart : null;
  });

  for (i = 0; i < charts.length; i++) {
    chart = 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

    var show = function() {
      if (points[0] && points[1]) {
        chart.tooltip.refresh(points); // Show the tooltip
        points[0].onMouseOver(); // Show the hover marker
        points[1].onMouseOver(); // Show the hover marker

        chart.xAxis[0].drawCrosshair(e, points[0]); // Show the crosshair
      }
    }

    if (i == 0) {
      chart2 = charts[i + 1];
      e2 = chart2.pointer.normalize(e); // Find coordinates within the chart
      points2 = [chart2.series[0].searchPoint(e2, true), chart2.series[1].searchPoint(e2, true)];

      if (((points[0] && points[1]) && points[0].x != points2[0].x && points[1].x != points2[1].x)) {
        //points[0].onMouseOut();
        //points[1].onMouseOut();
            chart.tooltip.refresh(points); // Show the tooltip
        points[0].select(false);
        points[1].select(false);

          //Highcharts.each(chart.hoverPoints, function(point) {
        //    point.setState('');
        //});


        chart.xAxis[0].drawCrosshair(e, points[0]); // Show the crosshair
        window.isOutOfSync = true;
      } else {
        window.isOutOfSync = false
        show();
      }

    } else {
      show();
    }

  }
});

0 个答案:

没有答案