我有一个折线图,可以在X轴上有两个点(具有不同的Y值),但在这种情况下,高图工具提示无法正常工作,jsfiddle如下:
这是代码:
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 :(得分:0)
添加以下代码,然后查看highcharts documentation
plotOptions: {
line: {
findNearestPointBy: 'x', //or "xy" to both axis
marker: {
enabled: true
}
}
}