DxChartArgumentAxis.AggregationInterval Property
Specifies the width of aggregation intervals in axis units. Applies only to axes of continuous and logarithmic types.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v24.2.dll
NuGet Package: DevExpress.Blazor
Declaration
[Parameter]
public ChartAxisInterval AggregationInterval { get; set; }
Property Value
Type | Description |
---|---|
ChartAxisInterval | A ChartAxisInterval value. |
Remarks
The Chart divides the argument axis into intervals to aggregate data. Series points that appear in the same interval are aggregated together. The AggregationInterval
property defines the width of each interval in axis units.
To specify the interval width in pixels instead, use the AggregationGroupWidth property. Regardless of how you specify intervals, you can display aggregated points between or aligned to major ticks (AggregatedPointPosition).
DateTime Axis
If the argument axis displays DateTime values, use one of ChartAxisInterval members related to date-time intervals.
The following example aggregates points by quarters (ChartAxisInterval.Quarter):
<DxChart Data="DataSource">
<DxChartLineSeries Name="Original Data"
T="SaleInfo"
TArgument="DateTime"
TValue="int"
ArgumentField="si => new DateTime(si.Date.Year, si.Date.Month, 1)"
ValueField="si => si.Amount"
Filter='si => si.Region == "North America"' />
<DxChartLineSeries Name="Aggregated Data"
T="SaleInfo"
TArgument="DateTime"
TValue="int"
ArgumentField="si => new DateTime(si.Date.Year, si.Date.Month, 1)"
ValueField="si => si.Amount"
Filter='si => si.Region == "North America"'>
<DxChartAggregationSettings Enabled="true" Method="ChartAggregationMethod.Sum" />
</DxChartLineSeries>
<DxChartArgumentAxis AggregationInterval="ChartAxisInterval.Quarter" />
<DxChartLegend Position="RelativePosition.Outside"
HorizontalAlignment="HorizontalAlignment.Right" />
</DxChart>
Numeric Axis
If the axis displays numbers, call the ChartAxisInterval.Numeric method to specify the interval. You can also omit the method call and pass a value to the property directly. In this case, the Chart automatically converts this value to a ChartAxisInterval value.
In the following example, the AggregationInterval
value produces intervals with the following start values: 0, 50, 100, 150, and so on:
<DxChart Data="DataSource">
<DxChartLineSeries Name="Original Data"
ArgumentField="@((DataPoint i) => i.X)"
ValueField="@((DataPoint i) => i.Y)"/>
<DxChartLineSeries Name="Aggregated Data"
ArgumentField="@((DataPoint i) => i.X)"
ValueField="@((DataPoint i) => i.Y)">
<DxChartAggregationSettings Enabled="true" Method="ChartAggregationMethod.Sum" />
</DxChartLineSeries>
<DxChartArgumentAxis AggregationInterval="50" />
<DxChartLegend Position="RelativePosition.Outside"
HorizontalAlignment="HorizontalAlignment.Right" />
</DxChart>
Logarithmic Axis
For a logarithmic axis, the interval is the exponent step. For example, if the LogarithmBase is 10
and the AggregationInterval
is 1
, the intervals with the following starting values are produced: 10⁰, 10¹, 10² 10³, and so on.
The following example specifies the AggregationInterval
for a logarithmic axis:
<DxChart Data="@GetData()" Width="950">
<DxChartArgumentAxis Type="ChartAxisType.Logarithmic"
LogarithmBase="2"
AggregationInterval="3" />
<DxChartLineSeries Name="Original Data"
ArgumentField="@((DataPoint s) => s.Argument)"
ValueField="@((DataPoint s) => s.Value)" />
<DxChartLineSeries Name="Aggregated Data"
ArgumentField="@((DataPoint s) => s.Argument)"
ValueField="@((DataPoint s) => s.Value)">
<DxChartAggregationSettings Enabled="true" Method="ChartAggregationMethod.Sum" />
</DxChartLineSeries>
<DxChartLegend Position="RelativePosition.Outside"
HorizontalAlignment="HorizontalAlignment.Right" />
</DxChart>
@code {
List<DataPoint> GetData() {
List<DataPoint> result = new List<DataPoint>(9);
result.Add(new DataPoint(0.15, 1));
result.Add(new DataPoint(8, 2));
result.Add(new DataPoint(32, 3));
result.Add(new DataPoint(64, 4));
result.Add(new DataPoint(128, 5));
result.Add(new DataPoint(256, 6));
result.Add(new DataPoint(512, 7));
result.Add(new DataPoint(2048, 8));
result.Add(new DataPoint(16348, 9));
return result;
}
struct DataPoint {
public double Argument { get; set; }
public double Value { get; set; }
public DataPoint(double argument, double value) {
Argument = argument;
Value = value;
}
}
}