updated: Function

Sets the updated event handler for crosshair which is triggered whenever axisY crosshair is updated.

Default: null
Example: updated: function(e) {
  alert(“Value: ” + e.value);
}
Note:
  • updated event handler can be used to sync crosshair across multiple charts in a page.
var chart = new CanvasJS.Chart("container",
{
 .
 .
 axisY: {
   .
   .
   crosshair: {
     enabled: true,
     updated: function ( e ) {
       console.log("Crosshair value: " + e.value);  
     }
   },
   .
   .   
 },
 .
 .
});
chart.render();

Event Object

e: {
 chart: {},
 crosshair: {options},
 axis: parent axis,
 value
}

Try Editing The Code

  Also See:    


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