I want to know dataPointIndex of scatter chart.
In the example below, the alert message of first point is “scatter, dataPoint {x:10, y:34}, index=0”
However, the actual index of “{x:10, y:34}” is 1.
I guess that the dataPoint is sorted.
Is there a way to get the original index?
var chart = new CanvasJS.Chart(“chartContainer”,
{
title:{
text: “Attaching Mouse Over event on dataSeries”
},
data: [
{
type: “scatter”,
mouseover: onMouseover,
dataPoints: [
{ x: 20, y: 45},
{ x: 10, y: 34},
{ x: 30, y: 19 },
{ x: 40, y: 75 },
{ x: 50, y: 15 },
{ x: 60, y: 60 },
{ x: 70, y: 48 },
{ x: 80, y: 04 },
{ x: 90, y: 35}
]
}
]
});
chart.render();
function onMouseover(e){
alert( e.dataSeries.type+ “, dataPoint { x:” + e.dataPoint.x + “, y: “+ e.dataPoint.y + ” }, index=” + e.dataPointIndex );
}