DevExtreme v23.2 is now available.

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

Your search did not match any results.

Server-Side Data Processing

In many cases, you need to process data on the server before a chart displays it. The Chart component supports this scenario.

In this demo, the data source of the Chart loads weather data for a selected month from an OData service. Each time you select a different month in the drop-down menu, the data source sends a new query to the service. To implement this functionality, assign a DataSource object to the Chart's dataSource property.

In the DataSource, implement the ODataStore. An OData service can include multiple entity collections related to each other, but the ODataStore specifies only one collection. To load multiple collections at once, set the expand property to an array with the additional collection titles. Then, call the postProcess function to process additional data.

Set the paginate property to false to prevent data from partitioning. You can also apply a filter to the received values.

Once you load the data, specify the series type and its nested options (argumentField and valueField), so the component can determine the objects that indicate Chart arguments and values in the data source.

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 Solution Wizard scaffolds an OData v4 Web API Service (.NET 6+) 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 Solution Wizard (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

www.wikipedia.org
Backend API
$(() => { const chartDataSource = new DevExpress.data.DataSource({ store: { type: 'odata', version: 2, url: 'https://js.devexpress.com/Demos/WidgetsGallery/odata/WeatherItems', }, postProcess(results) { return results[0].DayItems; }, expand: 'DayItems', filter: ['Id', '=', 1], paginate: false, }); const chartOptions = { dataSource: chartDataSource, title: 'Temperature in Seattle , 2017', size: { height: 420, }, series: { argumentField: 'Number', 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, }, }, loadingIndicator: { enabled: true, }, }; $('#chart').dxChart(chartOptions); $('#selectbox').dxSelectBox({ width: 150, items: months, value: 1, inputAttr: { 'aria-label': 'Month' }, valueExpr: 'id', displayExpr: 'name', onValueChanged(data) { chartDataSource.filter(['Id', '=', data.value]); chartDataSource.load(); }, }); });
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <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=1.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/23.2.5/css/dx.light.css" /> <script src="js/dx.all.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', }];