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 Editing The Code


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