Back to Devexpress

DxChartAggregationSettings.Method Property

blazor-devexpress-dot-blazor-dot-dxchartaggregationsettings-3742615c.md

latest5.1 KB
Original Source

DxChartAggregationSettings.Method Property

Specifies an aggregation method.

Namespace : DevExpress.Blazor

Assembly : DevExpress.Blazor.v25.2.dll

NuGet Package : DevExpress.Blazor

Declaration

csharp
[Parameter]
public ChartAggregationMethod Method { get; set; }

Property Value

TypeDescription
ChartAggregationMethod

A ChartAggregationMethod enumeration value.

|

Available values:

NameDescription
Auto

For most series types, the Average function is automatically applied.
For Range Area and Range Bar series types, the Range function is used.
For Stock and Candlestick series types, the Financial function is used.

| | Average |

Calculates the average value for a selected numeric or date-time interval.

| | Min |

Calculates the minimum value for a selected numeric or date-time interval.

| | Max |

Calculates the maximum value for a selected numeric or date-time interval.

| | Count |

Calculates the number of non-null values for a selected numeric or date-time interval.

| | Sum |

Calculates the summary for a selected numeric or date-time interval.

| | Financial |

Use this function for Stock and Candlestick series types.
The function aggregates financial data for a selected interval into a single high-low-open-close data point:

  • the high value equals the highest value of all data points in this interval;
  • the low value equals the lowest value of all data points;
  • the open value equals the open value of the first data point;
  • the close value equals the close value of the last data point.

| | Range |

Use this function for Range Area and Range Bar series types.
The function calculates the range of values for a selected numeric or date-time interval.

|

Remarks

Use the Method property to specify a method used to aggregate chart points with different argument values. The default method is Auto.

razor
<DxChart T="BargainDataPoint"
            Data="@UsdJpyData"
            @key="@Params.ThemeName"
            CssClass="w-100">
    <DxChartLegend Position="RelativePosition.Inside"
                    VerticalAlignment="VerticalEdge.Top"
                    HorizontalAlignment="HorizontalAlignment.Right" />
    <DxChartLineSeries T="BargainDataPoint"
                        TArgument="DateTime"
                        TValue="double"
                        ArgumentField="i => i.DateTimeStamp"
                        ValueField="i => i.Price"
                        Name="USDJPY">
        <DxChartSeriesPoint Visible="false" />
        <DxChartAggregationSettings Enabled="true" 
                                    Method="ChartAggregationMethod.Average" />
    </DxChartLineSeries>
    <DxChartArgumentAxis>
        <DxChartAxisRange StartValue="new DateTime(2020, 01, 01)"
                            EndValue="new DateTime(2021, 01, 29)" />
    </DxChartArgumentAxis>
    <DxChartZoomAndPanSettings ArgumentAxisZoomAndPanMode="ChartAxisZoomAndPanMode.Both" />
    <DxChartScrollBarSettings ArgumentAxisScrollBarVisible="true" 
                                ArgumentAxisScrollBarPosition="ChartScrollBarPosition.Bottom" />
    <DxChartTooltip Enabled="true" Position="RelativePosition.Outside">
        <div class="m-3">
            <div class="font-weight-bold">@(((DateTime)context.Point.Argument).ToString("d"))</div>
            <div>1$ = @(context.Point.Value)¥</div>
        </div>
    </DxChartTooltip>
</DxChart>

@code {
    IEnumerable<BargainDataPoint> UsdJpyData;
    @inject ICurrencyExchangeDataProvider UsdJpyDataProvider

    protected override async Task OnInitializedAsync() {
        UsdJpyData = await UsdJpyDataProvider.GetDataAsync();
    }
}
csharp
public class BargainDataPoint {
    public DateTime DateTimeStamp { get; }
    public double Price { get; }

    public BargainDataPoint(DateTime dateTimeStamp, double price) {
        DateTimeStamp = dateTimeStamp;
        Price = price;
    }
}

Run Demo: Charts - Zoom and Pan

See Also

DxChartAggregationSettings Class

DxChartAggregationSettings Members

DevExpress.Blazor Namespace