Your search did not match any results.
Charts

Discrete Axis Zooming and Scrolling

Documentation

Discrete data support is one of many strengths of the Chart widget. In this example, you can zoom data in the Chart using another DevExtreme HTML5 widget, the RangeSelector.

Copy to CodeSandBox
Apply
Reset
<template> <div> <div id="chart-demo"> <dx-chart id="zoomedChart" :data-source="dataSource" palette="Soft" title="The Chemical Composition of the Earth Layers" > <dx-series v-for="item in series" :value-field="item.valueField" :name="item.name" :key="item.name" /> <dx-common-series-settings :ignore-empty-points="true" type="bar" /> <dx-value-axis> <dx-label :customize-text="customizeText"/> </dx-value-axis> <dx-argument-axis :visual-range="range"/> <dx-legend :visible="true" vertical-alignment="top" horizontal-alignment="right" orientation="horizontal" > <dx-border :visible="true"/> </dx-legend> </dx-chart> <dx-range-selector :data-source="dataSource" :value.sync="range" > <dx-size :height="120"/> <dx-margin :left="10"/> <dx-scale :minor-tick-count="1"/> <dx-rs-chart palette="Soft" > <dx-rs-chart-series v-for="item in series" :value-field="item.valueField" :name="item.name" :key="item.name" /> <dx-common-series-settings-options :ignore-empty-points="true" type="bar" /> </dx-rs-chart> <dx-behavior call-value-changed="onMoving"/> </dx-range-selector> </div> </div> </template> <script> import { dataSource } from './data.js'; import { DxChart, DxValueAxis, DxArgumentAxis, DxLabel, DxLegend, DxBorder, DxCommonSeriesSettings, DxSeries } from 'devextreme-vue/chart'; import { DxRangeSelector, DxSize, DxMargin, DxScale, DxChart as DxRsChart, DxBehavior, DxCommonSeriesSettings as DxCommonSeriesSettingsOptions, DxSeries as DxRsChartSeries } from 'devextreme-vue/range-selector'; export default { components: { DxChart, DxValueAxis, DxArgumentAxis, DxLabel, DxLegend, DxBorder, DxRangeSelector, DxSize, DxMargin, DxScale, DxRsChart, DxBehavior, DxCommonSeriesSettings, DxCommonSeriesSettingsOptions, DxSeries, DxRsChartSeries }, data() { return { dataSource, range: [], series: [{ name: 'Si', valueField: 'Si' }, { name: 'Fe', valueField: 'Fe' }, { name: 'Ni', valueField: 'Ni' }, { name: 'S', valueField: 'S' }, { name: 'O', valueField: 'O' }, { name: 'Mg', valueField: 'Mg' }, { name: 'Al', valueField: 'Al' }, { name: 'K', valueField: 'K' }, { name: 'Na', valueField: 'Na' }] }; }, methods: { customizeText({ valueText }) { return `${valueText}%`; } } }; </script> <style scoped> #zoomedChart { margin-bottom: 20px; } </style>
import Vue from 'vue'; import App from './App.vue'; new Vue({ el: '#app', components: { App }, template: '<App/>' });
<!DOCTYPE html> <html> <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" /> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/19.2.4/css/dx.common.css" /> <link rel="dx-theme" data-theme="generic.light" href="https://cdn3.devexpress.com/jslib/19.2.4/css/dx.light.css" /> <script src="https://unpkg.com/core-js@2.4.1/client/shim.min.js"></script> <script src="https://unpkg.com/systemjs@0.21.3/dist/system.js"></script> <script type="text/javascript" src="config.js"></script> <script type="text/javascript"> System.import('./index.js'); </script> </head> <body class="dx-viewport"> <div class="demo-container"> <div id="app"> </div> </div> </body> </html>
export const dataSource = [{ arg: 'Inner Core', Si: 7.35, Fe: 79.39, Ni: 5.2, S: 2.3, O: 4.1 }, { arg: 'Outer Core', Si: 7.33, Fe: 78.56, Ni: 5.2, S: 2.7, O: 4.2 }, { arg: 'Lower Mantle', Si: 21.5, Fe: 5.8, O: 44.8, Mg: 22.8, Al: 2.2, Ca: 2.3, Na: 0.3, K: 0.03 }, { arg: 'Upper Mantle', Si: 28.1, Mg: 23.2, Fe: 4.3, Al: 1.2, Ca: 2.2, O: 40.3, Na: 0.2 }, { arg: 'Lower Crust', O: 46.6, Si: 27.7, Al: 8.1, Fe: 5, Ca: 3.6, Na: 2.8, K: 2.6, Mg: 1.5 }, { arg: 'Upper Crust', O: 47, Si: 29.5, Al: 8.05, Fe: 4.66, Ca: 2.96, Na: 2.5, K: 2.5, Mg: 1.87 }];
System.config({ transpiler: 'plugin-babel', paths: { 'npm:': 'https://unpkg.com/' }, map: { vue: 'npm:vue@2.6.3/dist/vue.esm.browser.js', 'vue-loader': 'npm:dx-systemjs-vue-browser@latest/index.js', 'devextreme': 'npm:devextreme@19.2', 'devextreme-vue': 'npm:devextreme-vue@19.2', jszip: 'npm:jszip@3.1.3/dist/jszip.min.js', 'quill': 'npm:quill@1.3.7/dist/quill.js', 'devexpress-diagram': 'npm:devexpress-diagram', 'devexpress-gantt': 'npm:devexpress-gantt', 'plugin-babel': 'npm:systemjs-plugin-babel@0/plugin-babel.js', 'systemjs-babel-build': 'npm:systemjs-plugin-babel@0/systemjs-babel-browser.js' }, meta: { '*.vue': { loader: 'vue-loader' } }, packages: { 'devextreme-vue': { main: 'index.js' }, 'devextreme': { defaultExtension: 'js' } }, babelOptions: { sourceMaps: false, stage0: true } });