get(String propertyName)

Returns the specified property of crosshair.


Parameters:
        propertyName: Name of the property

Example: chart.axisX[0].crosshair.get(“color”);

Note:
  • Chart should be rendered before you can use get method.

var chart = new CanvasJS.Chart("container",
{ 
 .
 .
   axisX: {
     crosshair: {
       enabled: true,
       color: "red"
     },
     .
   },
 .
 .
});
chart.render();

console.log(chart.axisX[0].crosshair.get("color"));

Properties accessible via get method

Please refer to crosshair element for the complete list of properties that can be accessed via get method.


Try it Yourself by Editing the Code below.




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.