Skip to main content

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

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

C#
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.

Razor
<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" />
            } else {
                <DxChartBarSeries Settings="@settings">
                    <DxChartSeriesLabel Visible="true" />
                </DxChartBarSeries>
            }
        </SeriesTemplate>
    </DxChartCommonSeries>
</DxChart>

Chart Series Template

Run Demo: Charts - Autogenerated Series

See Also