Setting snapToDataPoint to true automatically snaps crosshair to the nearest data point. Otherwise it follows mouse co-ordinates.
Default: falsevar chart = new CanvasJS.Chart("container", { . . axisX:{ crosshair:{ enabled: true, snapToDataPoint: true, . . } }, . . }); chart.render();