Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

DxChartCrosshairLabel Class

Defines a crosshair label.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
public class DxChartCrosshairLabel :
    DxComplexSettingsComponent<DxChartCrosshairLabel, CrosshairLabelModel>,
    IModelProvider<ChartFontModel>

#Remarks

Use the DxChartCrosshairLabel component to configure crosshair labels in the DxChart component.

DxChart - Crosshair Labels

@rendermode InteractiveServer

<DxChart Data="@DataSource"
         Width="100%"
         Height="500px">
    <DxChartTitle Text="DevAV Sales" />
    <DxChartArgumentAxis TickInterval="1">
        <DxChartAxisTitle Text="Year" />
        <DxChartAxisLabel Format="ChartElementFormat.Decimal()" />
    </DxChartArgumentAxis>
    <DxChartCrosshair Enabled="true"
                      Width="2"
                      DashStyle="ChartDashStyle.Dot"
                      Color="#5f368d"
                      Opacity="0.9">
        <DxChartCrosshairLabel Visible="true"
                               BackgroundColor="#888">
            <DxChartFont Color="white" />
        </DxChartCrosshairLabel>
    </DxChartCrosshair>
    <DxChartCommonSeries NameField="@((SalesAmountData s) => s.ProductCategory)"
                         ArgumentField="@((SalesAmountData s) => s.Year)"
                         ValueField="@((SalesAmountData s) => s.SalesAmount)">
        <SeriesTemplate Context="settings">
            <DxChartSplineSeries Settings="@settings" />
        </SeriesTemplate>
    </DxChartCommonSeries>
    <DxChartLegend VerticalAlignment="VerticalEdge.Bottom"
                   Position="RelativePosition.Outside" />
    <DxChartTooltip Enabled="true">
        <div style="margin: 0.75rem">
            <div>
                @($"{context.Point.SeriesName}:  ${context.Point.Value}K")
            </div>
        </div>
    </DxChartTooltip>
</DxChart>

@code {
    IEnumerable<SalesAmountData> DataSource = Enumerable.Empty<SalesAmountData>();
    protected override void OnInitialized() {
        DataSource = GenerateData();
    }
}
Show Nested Component Structure

Follow the steps below to show and customize crosshair labels:

  1. Add a DxChartCrosshair object to the chart markup and set the DxChartCrosshair.Enabled property to true.
  2. Add a DxChartCrosshairLabel object to the DxChartCrosshair component markup to configure common label settings. Enable the DxChartCrosshairLabel.Visible property to display labels.
  3. Optional. Override common settings for horizontal or vertical crosshair lines.

Refer to the DxChartCrosshair class description for more information and examples.

#Inheritance

Object
ComponentBase
DxSettingsComponent<DevExpress.Blazor.ClientComponents.Internal.CrosshairLabelModel>
DxComplexSettingsComponent<DxChartCrosshairLabel, DevExpress.Blazor.ClientComponents.Internal.CrosshairLabelModel>
DxChartCrosshairLabel
See Also