Skip to main content

Crosshair Cursor Customization

  • 5 minutes to read

This topic describes different ways to customize crosshair cursor elements and format crosshair label content. It also contains examples of how to do this in applications.

Interaction Customization

Formatting Crosshair Cursor Content

Use a pattern of crosshair axis and crosshair cursor labels

You can change the default format of text displayed within the crosshair labels by specifying a pattern (e.g., only show point values). To accomplish this, use the CrosshairAxisLabelOptions.Pattern, SeriesBase.CrosshairLabelPattern and CrosshairOptions.GroupHeaderPattern properties.

A full list of available placeholders is detailed below.

Pattern Description
{A} Displays a series point argument.
{V} Displays series point values.
{VP} Displays series point values as percentages (for a Pie series and Full-Stacked series).
{S} Displays the name of the series.
{G} Displays the name of a stacked group.
{W} Displays the weight (for a Bubble series).
{V1} Displays the first value (for range series).
{V2} Displays the second value (for range series).
{VD} Displays the duration between the first and second data point values (for range series).
{HV} Displays the high value (for a Financial series).
{LV} Displays the low value (for a Financial series).
{OV} Displays the open value (for a Financial series).
{CV} Displays the close value (for a Financial series).

The Format Specifiers topic explains which standard and custom formats can be used with placeholders to format numeric and date-time values within a crosshair cursor label.

The image below shows the SeriesBase.CrosshairLabelPattern property set to “{S}: {A} - {V}”.

When the chart control or a series is bound to data, the text pattern may contain data field values in addition to default placeholders. For example, if the data source contains the Discount field, then the text pattern may appear as follows: {S}: {V:F2} (Discount: {Discount:P0}). CrosshairLabelPattern


For real-world examples of how this can be done, see the following tutorial:

Appearance Customization

The following image highlights settings that configure the Crosshair Cursor appearance.


The properties in the table below allow you to customize the common appearance options of the crosshair cursor.

Member Description
CrosshairOptions.ValueLineColor Gets or sets the color of crosshair value lines.
CrosshairOptions.ValueLineStyle Gets the value line style settings of the crosshair cursor.
CrosshairOptions.ArgumentLineColor Gets or sets the color of crosshair argument lines.
CrosshairOptions.ArgumentLineStyle Gets the argument line style settings of the crosshair cursor.
CrosshairOptions.CrosshairLabelBackColor Gets or sets the background color of the Crosshair series label.
CrosshairOptions.CrosshairLabelTextOptions Returns text options of the Crosshair series label item.
CrosshairOptions.GroupHeaderTextOptions Returns text options of the Crosshair series label group header.


This example illustrates how to display the “Total” point value in the crosshair cursor panel.

To accomplish this task, handle the client-side ASPxClientWebChartControl.CustomDrawCrosshair event and use the last crosshair panel element’s LabelElement.footerText property to display the Total value.

View Example

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<%@ Register assembly="DevExpress.XtraCharts.v13.2.Web, Version=, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.XtraCharts.Web" tagprefix="dxchartsui" %>
<%@ Register assembly="DevExpress.XtraCharts.v13.2, Version=, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.XtraCharts" tagprefix="cc1" %>

<!DOCTYPE html>

<html xmlns="">
<head runat="server">
    <form id="form1" runat="server">

        <dxchartsui:WebChartControl ID="WebChartControl1" runat="server" ClientInstanceName="chartControl" CrosshairEnabled="True" Height="368px" Width="607px">
                    <axisx visibleinpanesserializable="-1">
                    <axisy visibleinpanesserializable="-1">
                <cc1:Series Name="Series 1">
                        <cc1:SeriesPoint ArgumentSerializable="A" Values="100">
                        <cc1:SeriesPoint ArgumentSerializable="B" Values="50">
                <cc1:Series Name="Series 2">
                        <cc1:SeriesPoint ArgumentSerializable="A" Values="150">
                        <cc1:SeriesPoint ArgumentSerializable="B" Values="200">
            <clientsideevents customdrawcrosshair="function(s, e) {
       var summary = 0;
    for (var i = 0; i &lt; e.crosshairElements.length; i++) {        
         summary += e.crosshairElements[i].Point.point.values[0];
            e.crosshairElements[e.crosshairElements.length - 1].LabelElement.footerText = 'Total :' + summary;
}" />

See Also