DevExtreme v25.2 is now available.

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

Your search did not match any results.

Vue 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
<template> <div id="chart-demo"> <DxChart :data-source="chartDataSource" :title="`Temperature in Seattle, ${year}`" > <DxSize :height="420"/> <DxValueAxis :grid="{ opacity: 0.2 }" value-type="numeric" > <DxLabel :customize-text="customizeLabelText"/> </DxValueAxis> <DxArgumentAxis type="discrete"> <DxGrid :visible="true" :opacity="0.5" /> <DxLabel :customize-text="customizeArgumentAxisLabelText"/> </DxArgumentAxis> <DxCommonPaneSettings> <DxBorder :visible="true" :width="2" :top="false" :right="false" /> </DxCommonPaneSettings> <DxSeries argument-field="Date" value-field="Temperature" type="spline" /> <DxLegend :visible="false"/> <DxTooltip :enabled="true" :customize-tooltip="customizeTooltip" /> <DxExport :enabled="true"/> <DxLoadingIndicator :enabled="true"/> </DxChart> <div class="action"> <div class="label">Choose a month:</div> <DxSelectBox id="selectbox" :width="150" :items="months" :input-attr="{ 'aria-label': 'Month' }" :value="selectedMonth" :on-value-changed="onValueChanged" value-expr="id" display-expr="name" /> </div> </div> </template> <script setup lang="ts"> import DxChart, { DxValueAxis, DxArgumentAxis, DxCommonPaneSettings, DxGrid, DxSeries, DxLegend, DxSize, DxBorder, DxLabel, DxTooltip, DxExport, DxLoadingIndicator, } from 'devextreme-vue/chart'; import DxSelectBox, { type DxSelectBoxTypes } from 'devextreme-vue/select-box'; import { DataSource } from 'devextreme-vue/common/data'; import { months } from './data.ts'; const year = 2017; let selectedMonth = 1; const startOfMonthStr = (month: number): string => `${month}/01/${year}`; const endOfMonthStr = (month: number): string => { 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 DataSource({ 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: Record<string, any>) => ({ ...item, Temperature: (item.MinTemp + item.MaxTemp) / 2, Date: new Date(item.Date), }))); }, paginate: false, }); const customizeLabelText = ({ valueText }: any) => `${valueText}${'&#176C'}`; const customizeArgumentAxisLabelText = ({ value }: any) => new Date(value).getDate().toString(); const customizeTooltip = ({ valueText }: any) => ({ text: `${valueText}${'&#176C'}`, }); function onValueChanged({ value }: DxSelectBoxTypes.ValueChangedEvent) { selectedMonth = value; chartDataSource.load(); } </script> <style> .action { width: 270px; margin-top: 20px; display: flex; justify-content: space-between; align-items: center; } </style>
window.exports = window.exports || {}; window.config = { transpiler: 'plugin-babel', meta: { '*.vue': { loader: 'vue-loader', }, '*.ts': { loader: 'demo-ts-loader', }, '*.svg': { loader: 'svg-loader', }, 'devextreme/time_zone_utils.js': { 'esModule': true, }, 'devextreme/localization.js': { 'esModule': true, }, 'devextreme/viz/palette.js': { 'esModule': true, }, 'devextreme-aspnet-data-nojquery': { 'esModule': true, }, 'openai': { 'esModule': true, }, }, paths: { 'project:': '../../../../', 'npm:': 'https://cdn.jsdelivr.net/npm/', 'bundles:': '../../../../bundles/', 'externals:': '../../../../bundles/externals/', 'anti-forgery:': '../../../../shared/anti-forgery/', }, map: { 'anti-forgery': 'anti-forgery:fetch-override.js', 'vue': 'npm:vue@3.4.27/dist/vue.esm-browser.js', '@vue/shared': 'npm:@vue/shared@3.4.27/dist/shared.cjs.prod.js', 'vue-loader': 'npm:dx-systemjs-vue-browser@1.1.2/index.js', 'demo-ts-loader': 'project:utils/demo-ts-loader.js', 'jszip': 'npm:jszip@3.10.1/dist/jszip.min.js', 'svg-loader': 'project:utils/svg-loader.js', 'devextreme-aspnet-data-nojquery': 'npm:devextreme-aspnet-data-nojquery@5.0.0/index.js', 'mitt': 'npm:mitt/dist/mitt.umd.js', 'rrule': 'npm:rrule@2.6.4/dist/es5/rrule.js', 'luxon': 'npm:luxon@3.4.4/build/global/luxon.min.js', 'es6-object-assign': 'npm:es6-object-assign', 'devextreme': 'npm:devextreme@link:../../packages/devextreme/artifacts/npm/devextreme/cjs', 'devextreme-vue': 'npm:devextreme-vue@link:../../packages/devextreme-vue/npm/cjs', 'devextreme-quill': 'npm:devextreme-quill@1.7.8/dist/dx-quill.min.js', 'devexpress-diagram': 'npm:devexpress-diagram@2.2.25/dist/dx-diagram.js', 'devexpress-gantt': 'npm:devexpress-gantt@4.1.66/dist/dx-gantt.js', 'inferno': 'npm:inferno@8.2.3/dist/inferno.min.js', 'inferno-compat': 'npm:inferno-compat/dist/inferno-compat.min.js', 'inferno-create-element': 'npm:inferno-create-element@8.2.3/dist/inferno-create-element.min.js', 'inferno-dom': 'npm:inferno-dom/dist/inferno-dom.min.js', 'inferno-hydrate': 'npm:inferno-hydrate/dist/inferno-hydrate.min.js', 'inferno-clone-vnode': 'npm:inferno-clone-vnode/dist/inferno-clone-vnode.min.js', 'inferno-create-class': 'npm:inferno-create-class/dist/inferno-create-class.min.js', 'inferno-extras': 'npm:inferno-extras/dist/inferno-extras.min.js', '@preact/signals-core': 'npm:@preact/signals-core@1.8.0/dist/signals-core.min.js', 'plugin-babel': 'npm:systemjs-plugin-babel@0.0.25/plugin-babel.js', 'systemjs-babel-build': 'npm:systemjs-plugin-babel@0.0.25/systemjs-babel-browser.js', // Prettier 'prettier/standalone': 'npm:prettier@2.8.8/standalone.js', 'prettier/parser-html': 'npm:prettier@2.8.8/parser-html.js', }, packages: { 'devextreme-vue': { main: 'index.js', }, 'devextreme-vue/common': { main: 'index.js', }, 'devextreme': { defaultExtension: 'js', }, 'devextreme/events/utils': { main: 'index', }, 'devextreme/common/core/events/utils': { main: 'index', }, 'devextreme/events': { main: 'index', }, 'es6-object-assign': { main: './index.js', defaultExtension: 'js', }, }, packageConfigPaths: [ 'npm:@devextreme/*/package.json', ], babelOptions: { sourceMaps: false, stage0: true, }, }; window.process = { env: { NODE_ENV: 'production', }, }; System.config(window.config); // eslint-disable-next-line const useTgzInCSB = ['openai'];
export 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', }];
import { createApp } from 'vue'; import App from './App.vue'; createApp(App).mount('#app');
<!DOCTYPE html> <html 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" /> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/25.2.5/css/dx.light.css" /> <script src="https://cdn.jsdelivr.net/npm/typescript@5.9.3/lib/typescript.js"></script> <script type="module"> import * as vueCompilerSFC from "https://cdn.jsdelivr.net/npm/@vue/compiler-sfc@3.4.27/dist/compiler-sfc.esm-browser.js"; window.vueCompilerSFC = vueCompilerSFC; </script> <script src="https://cdn.jsdelivr.net/npm/core-js@2.6.12/client/shim.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/systemjs@0.21.3/dist/system.js"></script> <script type="text/javascript" src="config.js"></script> <script type="text/javascript"> System.import("./index.ts"); </script> </head> <body class="dx-viewport"> <div class="demo-container"> <div id="app"> </div> </div> </body> </html>

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 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+ or JetBrains Rider.

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