问题
It looks like there is some bug in mouse event tracking in highcharts line plot, I am not sure whether its bug or not, I have one more post on same matter here few days ago, How to correct mouse event in Highcharts, in which one of the engineers of highcharts support, suggested to sort x axis, I did the same as he suggested, but result is one which I can't accept in practical
Here is link to Fiddle, please look into it
1 ) Good pattern yaxis sorted mouse event not working ---> Good
<script src="http://code.highcharts.com/highcharts.js"></script>
<div id="container" style="height: 400px"></div>
$(function () {
$('#container').highcharts({
title: {
text: 'Y axes reversed'
},
yAxis: {
reversed: true
},
series: [{
data:[
[ 25.290,1.000 ],
[ 25.240,2.000 ],
[ 25.210,3.000 ],
[ 25.190,4.000 ],
[ 25.180,5.000 ],
[ 25.170,6.000 ],
[ 25.160,7.000 ],
[ 25.310,8.000 ],
[ 25.210,9.000 ],
[ 25.170,10.000 ],
[ 25.160,11.000 ],
[ 25.160,12.000 ],
[ 25.150,13.000 ],
]
}]
});
});
2 ) Bad pattern xaxis sorted mouse event is working --->Bad
<script src="http://code.highcharts.com/highcharts.js"></script>
<div id="container" style="height: 400px"></div>
$(function () {
$('#container').highcharts({
title: {
text: 'Y axes reversed'
},
xAxis :{opposite: true, },
yAxis: {
reversed: true
},
series: [{
data:[
[ 25.150,13.000 ],
[ 25.160,12.000 ],
[ 25.160,11.000 ],
[ 25.160,7.000 ],
[ 25.170,6.000 ],
[ 25.170,10.000 ],
[ 25.180,5.000 ],
[ 25.190,4.000 ],
[ 25.210,9.000 ],
[ 25.210,3.000 ],
[ 25.240,2.000 ],
[ 25.290,1.000 ],
[ 25.310,8.000 ],
]
}]
});
});
Please someone help me to solve issue, This is what I have tried so far My Try on fiddle ,here you can see with same data y axis sorted with scatter plot mouse event is working but not working with line plot.
<script src="http://code.highcharts.com/highcharts.js"></script>
<div id="container" style="height: 400px"></div>
var chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
defaultSeriesType: 'scatter'
},
title :{
text:'overlap, scatter points on line for mouse events, trying to keep same color and legend so that mouse event might work, do not know how to do it'
},
xAxis : { opposite : true },
yAxis : { reversed : true },
series: [{
name: '07-Jan-2006 07:30:00 AM' ,
data:[
[ 25.290,1.000 ],
[ 25.240,2.000 ],
[ 25.210,3.000 ],
[ 25.190,4.000 ],
[ 25.180,5.000 ],
[ 25.170,6.000 ],
[ 25.160,7.000 ],
[ 25.310,8.000 ],
[ 25.210,9.000 ],
[ 25.170,10.000 ],
[ 25.160,11.000 ],
[ 25.160,12.000 ],
[ 25.150,13.000 ],
]
},{
name: '07-Jan-2006 07:30:00 AM' ,
type : 'line',
marker: {enabled:false},
enableMouseTracking: false,
data:[
[ 25.290,1.000 ],
[ 25.240,2.000 ],
[ 25.210,3.000 ],
[ 25.190,4.000 ],
[ 25.180,5.000 ],
[ 25.170,6.000 ],
[ 25.160,7.000 ],
[ 25.310,8.000 ],
[ 25.210,9.000 ],
[ 25.170,10.000 ],
[ 25.160,11.000 ],
[ 25.160,12.000 ],
[ 25.150,13.000 ],
]
}]
});
来源:https://stackoverflow.com/questions/22587836/bug-in-highcharts-mouse-event-with-plot-type-line-spline