DevExtreme v25.2 is now available.

Explore our newest features/capabilities and share your thoughts with us.

Your search did not match any results.

JavaScript/jQuery Charts - Server-Side Data Processing

DevExtreme Chart supports remote data processing. In this demo, the component loads weather data for the specified month from an ASP.NET backend service. When you change the month value via the dropdown, our Chart component sends a new query to update displayed data.

www.wikipedia.org
Backend API
$(() => { const year = 2017; let selectedMonth = 1; const startOfMonthStr = (month) => `${month}/01/${year}`; const endOfMonthStr = (month) => { const nextMonth = (month === 12) ? 1 : month + 1; const nextYear = (month === 12) ? year + 1 : year; const lastDay = new Date(nextYear, nextMonth - 1, 0).getDate(); return `${month}/${lastDay}/${year}`; }; const chartDataSource = new DevExpress.data.DataSource({ store: new DevExpress.data.CustomStore({ key: 'Date', load: () => { const startVisible = startOfMonthStr(selectedMonth); const endVisible = endOfMonthStr(selectedMonth); const url = 'https://js.devexpress.com/Demos/NetCore/api/TemperatureData' + `?startVisible=${encodeURIComponent(startVisible)}` + `&endVisible=${encodeURIComponent(endVisible)}` + `&startBound=${encodeURIComponent(startVisible)}` + `&endBound=${encodeURIComponent(endVisible)}`; return fetch(url) .then((r) => { if (!r.ok) throw new Error(`Network response fails: ${r.status}`); return r.json(); }) .then((arr) => arr.map((item) => ({ ...item, Temperature: (item.MinTemp + item.MaxTemp) / 2, Date: new Date(item.Date), }))); }, }), paginate: false, }); $('#chart').dxChart({ dataSource: chartDataSource, title: `Temperature in Seattle, ${year}`, size: { height: 420, }, series: { argumentField: 'Date', valueField: 'Temperature', type: 'spline', }, legend: { visible: false, }, commonPaneSettings: { border: { visible: true, width: 2, top: false, right: false, }, }, export: { enabled: true, }, tooltip: { enabled: true, customizeTooltip(arg) { return { text: `${arg.valueText}&#176C` }; }, }, valueAxis: { valueType: 'numeric', grid: { opacity: 0.2, }, label: { customizeText() { return `${this.valueText}&#176C`; }, }, }, argumentAxis: { type: 'discrete', grid: { visible: true, opacity: 0.5, }, label: { customizeText() { return new Date(this.value).getDate(); }, }, }, loadingIndicator: { enabled: true, }, }); $('#selectbox').dxSelectBox({ width: 150, items: months, value: selectedMonth, inputAttr: { 'aria-label': 'Month' }, valueExpr: 'id', displayExpr: 'name', onValueChanged(data) { selectedMonth = data.value; chartDataSource.load(); }, }); });
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <title>DevExtreme Demo</title> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script>window.jQuery || document.write(decodeURIComponent('%3Cscript src="js/jquery.min.js"%3E%3C/script%3E'))</script> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/25.2.4/css/dx.light.css" /> <script src="js/dx.all.js?v=25.2.4"></script> <script src="https://unpkg.com/devextreme-aspnet-data@5.0.0/js/dx.aspnet.data.js"></script> <script src="data.js"></script> <link rel="stylesheet" type="text/css" href="styles.css" /> <script src="index.js"></script> </head> <body class="dx-viewport"> <div class="demo-container"> <div id="chart-demo"> <div id="chart"></div> <div class="action"> <div class="label">Choose a month:</div> <div id="selectbox"></div> </div> </div> </div> </body> </html>
.action { width: 270px; margin-top: 20px; display: flex; justify-content: space-between; align-items: center; }
const months = [{ id: 1, name: 'January', }, { id: 2, name: 'February', }, { id: 3, name: 'March', }, { id: 4, name: 'April', }, { id: 5, name: 'May', }, { id: 6, name: 'June', }, { id: 7, name: 'July', }, { id: 8, name: 'August', }, { id: 9, name: 'September', }, { id: 10, name: 'October', }, { id: 11, name: 'November', }, { id: 12, name: 'December', }];

To bind data from a remote source, this demo implements a CustomStore (within a DataSource object) and fetches data using the load method. To process data on the server, the ASP.NET backend service is configured to accept processing operations in each request. For backend implementation details, refer to TemperatureDataController.cs in the ASP.NET Core version of this demo: Server-Side Data Processing - ASP.NET Core JavaScript Charts.

You can shape data within the DataSource as needed (for instance, apply a filter). Disable the paginate property to prevent data partitioning.

A 1-Click Solution for CRUD Web API Services with Role-based Access Control via EF Core

If you target .NET for your backend API, be sure to check out Web API Service and register your free copy today. The Template Kit scaffolds an OData v4 Web API Service (.NET 8+) with integrated authorization & CRUD operations powered by EF Core ORM. You can use OAuth2, JWT or custom authentication strategies alongside tools like Postman or Swagger (OpenAPI) for API testing. The built-in Web API Service also filters out secured server data based on permissions granted to users. Advanced/enterprise functions include audit trail, endpoints to download reports, file attachments, check validation, obtain localized captions, etc.

To use the free Template Kit (which creates the Web API Service), run the Universal Component Installer from the DevExpress Download Manager and use our predefined template in Visual Studio 2022+.

Read Tutorial | View Examples: JavaScript (DevExtreme) & JavaScript (Svelte) | Watch Videos