Skip to main content
All docs
V25.1
  • ChartLegendClickEventArgs Class

    Contains data for the LegendClick event.

    Namespace: DevExpress.Blazor

    Assembly: DevExpress.Blazor.v25.1.dll

    NuGet Package: DevExpress.Blazor

    Declaration

    public class ChartLegendClickEventArgs :
        EventArgs

    Remarks

    The DxChart component’s legend lists all chart series as legend items. When a user clicks an item, the component raises the LegendClick event. In a handler, you can use the Series argument property to obtain information about the series associated with the clicked legend item.

    <DxChart Data="@DataSource"
             @ref="chart"
             Width="1200px"
             Height="300px"
             SeriesSelectionMode="ChartSelectionMode.Single"
             LegendClick="@OnChartLegendClick">
        <DxChartBarSeries ArgumentField="@((StatisticPoint v) => v.Country)"
                          ValueField="@((StatisticPoint v) => v.Population24)"
                          Name="2024"
                          HoverMode="ChartSeriesPointHoverMode.None" />
        <DxChartLineSeries ArgumentField="@((StatisticPoint v) => v.Country)"
                           ValueField="@((StatisticPoint v) => v.Population23)"
                           Name="2023"
                           HoverMode="ChartContinuousSeriesHoverMode.None" />
        <DxChartLegend HoverMode="ChartLegendHoverMode.None" />
    </DxChart>
    
    @code {
        DxChart<StatisticPoint> chart;
    
        public void OnChartLegendClick(ChartLegendClickEventArgs args) {
            if (args.Series != null) {
                var SeriesName = args.Series.Name;
                var TotalPopulation = SeriesName == "2023" ? DataSource.Select(x => x.Population23).Sum() : DataSource.Select(x => x.Population24).Sum();
                ShowDetailDialog(SeriesName, TotalPopulation);
            }
        }
        // ...
    }
    

    Inheritance

    Object
    EventArgs
    ChartLegendClickEventArgs
    See Also