Articles in this section
Category / Section

How to enable crosshair and crosshair labels in the Chart?

2 mins read

Crosshair is an interactive feature in the Chart that displays horizontal and vertical lines along with tooltip like labels in the horizontal and vertical axes on mouse hover of the chart area. Refer to the Crosshair and Trackball for more information on the features.

To enable Crosshair, the visible property should be enabled. To display the Crosshair label in axis, the visible property of the crosshairLabel in the corresponding axis should be enabled. Crosshair label in the horizontal axis displays the X value and vertical axis displays the Y value of the current mouse move coordinate.

The following code example illustrates this.

 

<div id="container"></div>
<script type="text/javascript">
$(function () {
    $("#container").ejChart({
        . . . . .
        primaryXAxis: {
            crosshairLabel : { visible: true }
        },
        primaryYAxis: {
            crosshairLabel : { visible: true }
        },
        crosshair: {
            visible: true,
            type: "crosshair"
        }
        . . . . .
    });
});
</script>

 

The following screenshot display the Crosshair in the Chart.

 

Enabling crosshair and crosshair labels in the Chart

 

JS Playground Sample Link: Crosshair

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied