2017-05-25 68 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

謝謝!有效。 –