ChartSeriesClickEventArgs Class
Provides data for the SeriesClick event.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v24.2.dll
NuGet Package: DevExpress.Blazor
Declaration
public class ChartSeriesClickEventArgs :
EventArgs
Remarks
Use the Series property to obtain the clicked series settings.
The following code sample obtains data when you click chart series. When a user clicks a chart series, a list with city names related to the corresponding region is displayed under the chart.
The following image illustrates the list with Beijing, Tokyo, and Seoul city names displayed when a user clicks the Asia series:
@using Chart.Data
<DxChart Data="@SalesData" SeriesClick=@OnSeriesClick>
<DxChartCommonSeries SummaryMethod="Enumerable.Sum"
NameField="@((SaleInfo s) => s.Region)"
ArgumentField="@((SaleInfo s) => s.Date.Year)"
ValueField="@((SaleInfo s) => s.Amount)"
SeriesType="ChartSeriesType.Area">
</DxChartCommonSeries>
<DxChartArgumentAxis DivisionFactor="400"/>
<DxChartLegend Position="RelativePosition.Outside"/>
</DxChart>
@foreach(var city in cities) {
<table><td>Region City:</td><td>@city</td></table>
}
@code {
IEnumerable<SaleInfo> SalesData;
IEnumerable<string> cities = Enumerable.Empty<string>();
protected override async Task OnInitializedAsync() {
SalesData = await Sales.GetSalesAsync();
}
void OnSeriesClick(ChartSeriesClickEventArgs args) {
cities = SalesData.Where(item => item.Region == args.Series.Name).Select(item => ((SaleInfo)item).City).Distinct();
}
}
See Also