2017-05-25 76 views
0

我有可以在X轴的两个点(具有不同的Y值),折线图,但highcharts提示不会在这种情况下正常工作,的jsfiddle低于:Highchart悬停提示不能正常工作

http://jsfiddle.net/p5d1tzws/

这里的TE代码:

Highcharts.chart('container', { 
    chart: { 
     type: 'line' 
    }, 
    title: { 
     text: 'Area chart with negative values' 
    }, 
    xAxis: { 
     categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas'] 
    }, 
    credits: { 
     enabled: false 
    }, 
    series: [{ 
      name: 'John', 
      data: [{ 
        name: 'Point 1', 
        y: 2, 
        x: 1 
       }, { 
        name: 'Point 2', 
        x: 1, 
        y: 4 
       }, { 
        name: 'Point 3', 
        x: 2, 
        y: 5 
       }, { 
        name: 'Point 4', 
        x: 2, 
        y: 8 
       }, { 
        name: 'Point 5', 
        x: 3, 
        y: 10 
       } 
      ] 
     } 
    ] 
}); 

回答

0

添加以下代码,然后看highcharts documentation

plotOptions: { 
    line: { 
     findNearestPointBy: 'x', //or "xy" to both axis 
     marker: { 
     enabled: true 
     } 
    } 
    } 
+0

谢谢!有效。 –