Your search did not match any results.
Bar Charts

Drill-Down Chart

Documentation

This demo shows a drill-down chart with two views. The start view displays a breakdown of population by continents. When you click a bar, the detailed view reveals most populated countries on the selected continent. Data for this view is provided by applying a filter to the original data.

Copy to CodeSandBox
Apply
Reset
<template> <div> <dx-chart id="chart" :customize-point="customizePoint" :class="isFirstLevel ? 'pointer-on-bars' : ''" :data-source="dataSource" title="The Most Populated Countries by Continents" @point-click="onPointClick" > <dx-series type="bar"/> <dx-value-axis :show-zero="false"/> <dx-legend :visible="false"/> </dx-chart> <dx-button :visible="!isFirstLevel" class="button-container" text="Back" icon="chevronleft" @click="onButtonClick" /> </div> </template> <script> import { DxChart, DxSeries, DxValueAxis, DxLegend, } from 'devextreme-vue/chart'; import { DxButton } from 'devextreme-vue/button'; import service from './data.js'; const colors = ['#6babac', '#e55253']; export default { components: { DxChart, DxSeries, DxValueAxis, DxLegend, DxButton }, data() { return { isFirstLevel: true, dataSource: service.filterData(''), }; }, methods: { customizePoint() { return { color: colors[Number(this.isFirstLevel)], hoverStyle: !this.isFirstLevel ? { hatching: 'none' } : {} }; }, onPointClick(e) { if (this.isFirstLevel) { this.isFirstLevel = false; this.dataSource = service.filterData(e.target.originalArgument); } }, onButtonClick() { if (!this.isFirstLevel) { this.isFirstLevel = true; this.dataSource = service.filterData(''); } } } }; </script> <style> #chart { height: 440px; width: 100%; } #chart.pointer-on-bars .dxc-series rect { cursor: pointer; } .button-container { text-align: center; height: 40px; position: absolute; top: 7px; left: 0px; } </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.1.4/css/dx.common.css" /> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/19.1.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"> <span v-if="false">Loading...</span> </div> </div> </body> </html>
const data = [ { arg: 'Asia', val: 3007613498, parentID: '' }, { arg: 'North America', val: 493603615, parentID: '' }, { arg: 'Europe', val: 438575293, parentID: '' }, { arg: 'Africa', val: 381331438, parentID: '' }, { arg: 'South America', val: 331126555, parentID: '' }, { arg: 'Nigeria', val: 181562056, parentID: 'Africa' }, { arg: 'Egypt', val: 88487396, parentID: 'Africa' }, { arg: 'Congo', val: 77433744, parentID: 'Africa' }, { arg: 'Morocco', val: 33848242, parentID: 'Africa' }, { arg: 'China', val: 1380083000, parentID: 'Asia' }, { arg: 'India', val: 1306687000, parentID: 'Asia' }, { arg: 'Pakistan', val: 193885498, parentID: 'Asia' }, { arg: 'Japan', val: 126958000, parentID: 'Asia' }, { arg: 'Russia', val: 146804372, parentID: 'Europe' }, { arg: 'Germany', val: 82175684, parentID: 'Europe' }, { arg: 'Turkey', val: 79463663, parentID: 'Europe' }, { arg: 'France', val: 66736000, parentID: 'Europe' }, { arg: 'United Kingdom', val: 63395574, parentID: 'Europe' }, { arg: 'United States', val: 325310275, parentID: 'North America' }, { arg: 'Mexico', val: 121005815, parentID: 'North America' }, { arg: 'Canada', val: 36048521, parentID: 'North America' }, { arg: 'Cuba', val: 11239004, parentID: 'North America' }, { arg: 'Brazil', val: 205737996, parentID: 'South America' }, { arg: 'Colombia', val: 48400388, parentID: 'South America' }, { arg: 'Venezuela', val: 30761000, parentID: 'South America' }, { arg: 'Peru', val: 28220764, parentID: 'South America' }, { arg: 'Chile', val: 18006407, parentID: 'South America' } ]; export default { filterData(name) { return data.filter(function(item) { return item.parentID === name; }); } };
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:systemjs-vue-browser@latest/index.js', 'devextreme': 'npm:devextreme@19.1', 'devextreme-vue': 'npm:devextreme-vue@19.1', jszip: 'npm:jszip@3.1.3/dist/jszip.min.js', 'quill': 'npm:quill@1.3.6/dist/quill.js', 'devexpress-diagram': 'npm:devexpress-diagram', '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 } });