ChartSeriesSettings<T, TGroupKey, TValue, TArgument>.GroupKey Property
A value of a data source field that is used to group data.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v24.2.dll
NuGet Package: DevExpress.Blazor
Declaration
public TGroupKey GroupKey { get; set; }
Property Value
Type | Description |
---|---|
TGroupKey | An object of the NameField field’s data type that specifies the group value. |
Remarks
The SeriesTemplate property allows you to specify a template for a Chart series. The property gets an object of the ChartSeriesSettings<T, TGroupKey, TValue, TArgument> type that contains information about the rendered series. To access this object, use the template’s context
parameter.
Assign the obtained context
to the Settings property to specify settings for the rendered series. The context.GroupKey
property allows you to group Chart data by an individual data source value. The data source field whose values are used to group data is specified by the NameField property.
<DxChart Data="@GridData">
<DxChartTitle Text="Sales amount" />
<DxChartCommonSeries
SummaryMethod="Enumerable.Sum"
NameField="@((SaleInfo s) => s.Date.Year)"
ArgumentField="@((SaleInfo s) => s.City)"
ValueField="@((SaleInfo s) => s.Amount)">
<SeriesTemplate Context="settings">
@if(settings.GroupKey == 2015) {
<DxChartLineSeries Name="Last year" Settings="@settings">
</DxChartLineSeries>
} else {
<DxChartBarSeries Settings="@settings">
<DxChartSeriesLabel Visible="true"></DxChartSeriesLabel>
</DxChartBarSeries>
}
</SeriesTemplate>
</DxChartCommonSeries>
</DxChart>