Angular Chart - crosshair

Configures the crosshair feature.

Type:

Object

Crosshair is a pointer represented by two mutually-crossing lines stretched over the entire chart plot. The crosshair helps a user identify the values of the series points precisely. When enabled, the crosshair follows the cursor and snaps to the nearest series point.

DevExtreme HTML5 Charts Crosshair

To enable the crosshair, set the crosshair.enabled option to true. Assign true to the crosshair.label.visible option as well to make the crosshair labels visible.

Settings specified in the crosshair object apply to both the crosshair lines. If you specify the same settings within the horizontalLine or verticalLine object, they will apply to the particular crosshair line only. Note that individual settings override common ones.

View Demo

color

Specifies the color of the crosshair lines.

Type:

String

Default Value: '#f05b41'

This option supports the following colors:

dashStyle

Specifies the dash style of the crosshair lines.

Type:

String

Default Value: 'solid'
Accepted Values: 'dash' | 'dot' | 'longDash' | 'solid'

This option accepts one of the following values.

  • solid
    Displays solid, continuous crosshair lines.
  • dash
    Displays the crosshair lines using short dashes.
  • longDash
    Displays the crosshair lines using long dashes.
  • dot
    Displays the crosshair lines using dots.
  • Any combination of 'longDash', 'dash' and 'dot'
    Displays the crosshair lines by repeating the specified combination. For example, 'dashdotdash'.

Use the DashStyle enum to specify this option when the widget is used as an ASP.NET MVC Control. This enum accepts the following values: Solid, LongDash, Dash, and Dot.

enabled

Enables the crosshair.

Type:

Boolean

Default Value: false

horizontalLine

Configures the horizontal crosshair line individually.

Type:

Object

|

Boolean

Crosshair lines can be configured using the following objects.

  • crosshair.horizontalLine
    Configures the horizontal crosshair line only.

  • crosshair.verticalLine
    Configures the vertical crosshair line only.

  • crosshair
    Configures both the crosshair lines.

Options declared in the horizontalLine and verticalLine objects override the options declared in the crosshair object.

NOTE
Instead of an object, you can assign a Boolean value to the horizontalLine field. This value will control the visibility of the horizontal crosshair line.

label

Configures the crosshair labels.

Type:

Object

Crosshair labels appear on the chart axes when a user pauses on a series point. They display the argument and the value of this series point.

DevExtreme HTML5 Charts CrosshairLabels

There are two crosshair labels on a chart - one for each crosshair line, and the label object described here configures both. If you need to set options individually for each label, use the label object within the crosshair.horizontalLine or crosshair.verticalLine object. Individual settings override common ones.

Because the crosshair labels are hidden by default, assign true to the label.visible field if you need them to be shown.

opacity

Specifies how transparent the crosshair lines should be.

Type:

Number

Default Value: undefined

This option accepts a value from 0 to 1, where 0 makes the crosshair lines completely transparent, and 1 makes them opaque.

verticalLine

Configures the vertical crosshair line individually.

Type:

Object

|

Boolean

Crosshair lines can be configured using the following objects.

  • crosshair.horizontalLine
    Configures the horizontal crosshair line only.

  • crosshair.verticalLine
    Configures the vertical crosshair line only.

  • crosshair
    Configures both the crosshair lines.

Options declared in the horizontalLine and verticalLine objects override the options declared in the crosshair object.

NOTE
Instead of an object, you can assign a Boolean value to the verticalLine field. This value will control the visibility of the vertical crosshair line.

width

Specifies the width of the crosshair lines.

Type:

Number

Default Value: 1