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 it Yourself by Editing the Code below.


  Also See:    



In order to provide better support, we have closed the comments and switched completely to our Forums.
If you have any questions, please feel free to ask in our forums.