How to enable Crosshair and CrosshairLabel in ASP.NET MVC Chart?
Crosshair is an interactive feature in the Chart that displays horizontal and vertical lines along with ToolTip like labels in horizontal and vertical axes when mouse hovers over the chart area. Refer to Crosshair and Trackball for more information on crosshair and trackball features.
To enable crosshair, Visible property of the Crosshair should be enabled. To display the crosshair label in axis, Visible property of CrosshairLabel in the corresponding axis should be enabled. Crosshair label in horizontal axis displays the X value and vertical axis displays the Y value of the current mouse hover co-ordinate.
The following code example illustrates this.
@(Html.EJ().Chart("container") .Crosshair(crosshair=> crosshair.Visible(true)) .PrimaryXAxis(xAxis=> xAxis.CrosshairLabel(label=> label.Visible(true) )) . . . . . . . . . . . . )
The output of the above code displays the Chart similar to the following screenshot.
Sample Link: Crosshair
Conclusion
I hope you enjoyed learning about how to enable Crosshair and CrosshairLabel in Chart.
You can refer to our ASP.NET MVC Chart feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our ASP.NET MVC Chart example to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!