showAt(Mixed value)
Shows crosshair at the specified value on respective axis, when crosshair is enabled.
Parameters:
value: value at which crosshair has to be shown. Value can be a number, timestamp or dateTime object.
Returns:
Boolean: Returns true if the operation was successful. Else returns false.
Example: chart.axisX[0].crosshair.showAt(10);
Note:
- Chart should be rendered before you can use showAt method.
- showAt method can be used to sync crosshair across multiple charts present in a single page.
var chart = new CanvasJS.Chart("container",
{
.
.
axisX: {
crosshair: {
enabled: true
},
.
},
.
.
});
chart.render();
chart.axisX[0].crosshair.showAt(20);
Syncing Crosshair
Below is an example showing synchronizing crosshair across multiple charts.
Try it Yourself by Editing the Code below.