Pull down to refresh...
Release to refresh...
Refreshing...
-
Data Grid
- Overview
-
Data Binding
-
Paging and Scrolling
-
Editing
-
Grouping
-
Filtering and Sorting
- Focused Row
-
Row Drag & Drop
-
Selection
-
Columns
- State Persistence
-
Appearance
-
Templates
-
Data Summaries
-
Master-Detail
-
Export to PDF
-
Export to Excel
-
Adaptability
- Keyboard Navigation
-
Pivot Grid
- Overview
-
Data Binding
-
Field Chooser
-
Features
-
Export to Excel
-
Tree List
- Overview
-
Data Binding
- Sorting
- Paging
-
Editing
- Node Drag & Drop
- Focused Row
-
Selection
-
Filtering
-
Column Customization
- State Persistence
- Adaptability
- Keyboard Navigation
-
Scheduler
- Overview
-
Data Binding
-
Views
-
Features
- Virtual Scrolling
-
Grouping
-
Customization
- Adaptability
-
Html Editor
-
Chat
-
Diagram
- Overview
-
Data Binding
-
Featured Shapes
-
Custom Shapes
-
Document Capabilities
-
User Interaction
- UI Customization
- Adaptability
-
Charts
- Overview
-
Data Binding
-
Area Charts
-
Bar Charts
- Bullet Charts
-
Doughnut Charts
-
Financial Charts
-
Line Charts
-
Pie Charts
-
Point Charts
-
Polar and Radar Charts
-
Range Charts
-
Sparkline Charts
-
Tree Map
-
Funnel and Pyramid Charts
- Sankey Chart
-
Combinations
-
More Features
-
Export
-
Selection
-
Tooltips
-
Zooming
-
-
Gantt
- Overview
-
Data
-
UI Customization
- Strip Lines
- Export to PDF
- Sorting
-
Filtering
-
Reporting
- AI-powered Extensions
-
Interaction
-
Report Types
-
Data binding
-
Real-life Reports
-
Layout Features
-
Report Controls
-
Web-specific Features
-
Rich Text Editor
- Overview
- Load/Save
- Document Protection
-
Templates
- Autocorrect
-
Customization
- Simple View
-
Spreadsheet
- Overview
-
Open a Document
- Export And Printing
-
Features
-
UI Customization
-
Gauges
- Overview
-
Data Binding
-
Bar Gauge
-
Circular Gauge
-
Linear Gauge
-
Navigation
- Overview
- Accordion
-
Menu
- Multi View
-
Drawer
-
Tab Panel
-
Tabs
-
Toolbar
- Pagination
-
Tree View
- Right-to-Left Support
-
Layout
-
Tile View
- Splitter
-
Gallery
- Scroll View
- Resizable
-
-
Editors
- Overview
- Autocomplete
-
Calendar
- Check Box
- Color Box
- Date Box
-
Date Range Box
-
Drop Down Box
-
Number Box
-
Select Box
- Switch
-
Tag Box
- Text Area
- Text Box
- Validation
- Custom Text Editor Buttons
- Right-to-Left Support
- Editor Appearance Variants
-
Forms and Multi-Purpose
- Overview
- Button Group
- Field Set
-
Filter Builder
-
Form
- Radio Group
-
Range Selector
- Numeric Scale (Lightweight)
- Numeric Scale
- Date-Time Scale (Lightweight)
- Date-Time Scale
- Logarithmic Scale
- Discrete scale
- Custom Formatting
- Use Range Selection for Calculation
- Use Range Selection for Filtering
- Image on Background
- Chart on Background
- Customized Chart on Background
- Chart on Background with Series Template
- Range Slider
- Slider
-
Sortable
-
File Management
-
File Manager
- Overview
-
File System Types
-
Customization
-
File Uploader
-
-
Actions and Lists
-
Maps
- Overview
-
Map
-
Vector Map
-
Dialogs and Notifications
-
Localization
Related Demos:
Your search did not match any results.
Loading...
Charts - Points Aggregation
This demo illustrates the Chart's data aggregation feature using the line, range area, and bar series. The line series shows temperature changes using average, minimum, or maximum temperature values in the selected time interval. The range area series shows the temperature range for the same time interval and uses a custom aggregate function. The bar series illustrates precipitation and is not aggregated.
Was this demo helpful?
Feel free to share demo-related thoughts here.
If you have technical questions, please create a support ticket in the DevExpress Support Center.
Thank you for the feedback!
If you have technical questions, please create a support ticket in the DevExpress Support Center.
Backend API
x
<div id="chart-demo">
@(Html.DevExtreme().Chart()
.ID("chart")
.Title("Weather in Las Vegas, NV (2017)")
.CommonSeriesSettings(s => s.ArgumentField("Date"))
.ArgumentAxis(a => {
a.ArgumentType(ChartDataType.DateTime);
a.AggregationInterval(VizTimeInterval.Week);
a.ValueMarginsEnabled(false);
})
.ValueAxis(a => {
a.Add()
.Name("temperature")
.Title(t => t.Text("Temperature, °C").Font(f => f.Color("#e91e63")))
.Label(l => l.Font(f => f.Color("#e91e63")));
a.Add()
.Name("precipitation")
.Position(Position.Right)
.Title(t => t.Text("Precipitation, mm").Font(f => f.Color("#03a9f4")))
.Label(l => l.Font(f => f.Color("#03a9f4")));
})
.Legend(l => l.Visible(false))
.Series(s => {
s.Add()
.Axis("precipitation")
.Color("#03a9f4")
.Type(SeriesType.Bar)
.ValueField("Precip")
.Name("Precipitation");
s.Add()
.Axis("temperature")
.Color("#ffc0bb")
.Type(SeriesType.RangeArea)
.RangeValue1Field("MinTemp")
.RangeValue2Field("MaxTemp")
.Aggregation(a => {
a.Enabled(true);
a.Method(ChartSeriesAggregationMethod.Custom);
a.Calculate(@<text>
function(aggregationInfo, series) {
if(!aggregationInfo.data.length) {
return;
}
var temp = aggregationInfo.data.map(function(item) { return item.Temp; }),
maxTemp = Math.max.apply(null, temp),
minTemp = Math.min.apply(null, temp);
return {
Date: new Date((aggregationInfo.intervalStart.valueOf() + aggregationInfo.intervalEnd.valueOf()) / 2),
MaxTemp: maxTemp,
MinTemp: minTemp
};
}
</text>);
})
.Name("Temperature range");
s.Add()
.Axis("temperature")
.Color("#e91e63")
.ValueField("Temp")
.Point(p => p.Size(7))
.Aggregation(a => a.Enabled(true))
.Name("Average temperature");
})
.Tooltip(t => {
t.Enabled(true);
t.CustomizeTooltip(@<text>
function(arg) {
return customTooltipHandlers[arg.seriesName](arg, arg.point.aggregationInfo);
}
</text>);
})
.DataSource(d => d.Mvc().LoadAction("GetWeatherIndicators"))
)
<div class="options">
<div class="caption">Options</div>
<div class="option">
@(Html.DevExtreme().CheckBox()
.Text("Aggregation enabled")
.Value(true)
.OnValueChanged(@<text>
function(data) {
var chart = $("#chart").dxChart("instance");
chart.option("series[1].aggregation.enabled", data.value);
chart.option("series[2].aggregation.enabled", data.value);
}
</text>)
)
</div>
<div class="option">
<span>Interval:</span>
@(Html.DevExtreme().SelectBox()
.DataSource(new JS("intervals"))
.Value(VizTimeInterval.Week)
.ValueExpr("Interval")
.InputAttr("aria-label", "Interval")
.DisplayExpr("DisplayName")
.OnValueChanged(@<text>
function (data) {
$("#chart").dxChart("instance").option("argumentAxis.aggregationInterval", data.value);
}
</text>)
)
</div>
<div class="option">
<span>Method:</span>
@(Html.DevExtreme().SelectBox()
.DataSource(new[] {
new { DisplayName = "Average", Func = "avg" },
new { DisplayName = "Minimum", Func = "min" },
new { DisplayName = "Maximum", Func = "max" }
})
.Value(ChartSeriesAggregationMethod.Avg)
.ValueExpr("Func")
.InputAttr("aria-label", "Function")
.DisplayExpr("DisplayName")
.OnValueChanged(@<text>
function (data) {
$("#chart").dxChart("instance").option("series[2].aggregation.method", data.value);
}
</text>)
)
</div>
</div>
</div>
<script>
var intervals = [{
DisplayName: "One week",
Interval: "week"
}, {
DisplayName: "Two weeks",
Interval: { weeks: 2 }
}, {
DisplayName: "Month",
Interval: "month"
}];
var customTooltipHandlers = {
"Average temperature": function (arg, aggregationInfo) {
var start = aggregationInfo && aggregationInfo.intervalStart,
end = aggregationInfo && aggregationInfo.intervalEnd;
return {
text: (!aggregationInfo ?
"Date: " + arg.argument.toDateString() :
"Interval: " + start.toDateString() +
" - " + end.toDateString()) +
"<br/>Temperature: " + arg.value.toFixed(2) + " °C"
};
},
"Temperature range": function (arg, aggregationInfo) {
var start = aggregationInfo.intervalStart,
end = aggregationInfo.intervalEnd;
return {
text: "Interval: " + start.toDateString() +
" - " + end.toDateString() +
"<br/>Temperature range: " + arg.rangeValue1 +
" - " + arg.rangeValue2 + " °C"
};
},
"Precipitation": function (arg) {
return {
text: "Date: " + arg.argument.toDateString() +
"<br/>Precipitation: " + arg.valueText + " mm"
};
}
};
</script>
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx
xxxxxxxxxx