To aggregate points on discrete axes, follow the steps below.
Enable aggregation.
You can enable data aggregation for the following series:
Individual series
Assign true to the series.aggregation.enabled property.
All series of a specific type
Assign true to the aggregaion.enabled property that belongs to the configuration object of a specific series type.
All series in the Chart
Assign true to the commonSeriesSettings.aggregation.enabled property.
Individual series aggregation settings have priority over common aggregation settings in the component. For example, you can enable aggregation for all series and disable it for a specific series.
In this demo, data aggregation is enabled for all series.
sum method is used.@(Html.DevExtreme().Chart()
.ID("chart")
.Title(t => t.Text("Production of Crude Oil").Subtitle("(in Barrels)"))
.CommonSeriesSettings(s => {
s.Aggregation(a => a.Enabled(true).Method(ChartSeriesAggregationMethod.Sum))
.ArgumentField("State")
.ValueField("Value")
.Type(SeriesType.Bar);
})
.SeriesTemplate(t => t.NameField("Year"))
.DataSource(Model)
)
using DevExtreme.AspNet.Data;
using DevExtreme.AspNet.Mvc;
using DevExtreme.MVC.Demos.Models.SampleData;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using System.Web.Mvc;
namespace DevExtreme.MVC.Demos.Controllers {
public class ChartsController : Controller {
public ActionResult DiscretePointsAggregation() {
return View(SampleData.OilProductionByMonths);
}
}
}
#chart {
height: 440px;
}