snapToDataPoint: Boolean

Setting snapToDataPoint to true automatically snaps crosshair to the nearest data point. Otherwise it follows mouse co-ordinates.

Default: false
Options: true, false
var  chart =  new  CanvasJS.Chart("container",
{
 .
 .
axisX:{
    crosshair:{
        enabled: true,
        snapToDataPoint: true,
	.
	.
    }
},
 .
 . 
});
chart.render();


Try Editing The Code

  Also See:    


If you have any questions, please feel free to ask in our forums.Ask Question