A custom formatter function that returns Crosshair’s label.
var chart = new CanvasJS.Chart("container",
{
.
.
axisY:{
crosshair:
{
enabled: true,
labelFormatter: function ( e ) {
return "Custom Point" + e.value;
}
}
},
.
.
});
chart.render();
By using labelFormatter, you can return any value to be displayed as crosshair’s label.
Below is the structure of object passed as parameter to the function:
e: { // parameter sent to function
chart,
axis,
crosshair,
value
}
If you have to access any preset options of the chart, you can access them via e.chart.options. For example e.chart.options.title.text
Also See: