Your search did not match any results.
Bar Charts

Auto-Calculated Bar Width

Documentation

This demo illustrates a common issue in multi-series charts. Individual series can skip values for certain arguments or include zero values. In such cases, arguments can display a different number of bars and cause uneven gaps between data.

The ignoreEmptyPoints option allows you to change this behavior. If you set it to true, bars increase their width to fill the gaps. In this demo, you can see how the option affects the following arguments: Iran, Canada, Saudi Arabia, and Mexico.

www.geohive.com
Copy to CodeSandBox
Apply
Reset
<template> <DxChart id="chart" :data-source="dataSource" palette="Soft" title="Percent of Total Energy Production" > <DxCommonSeriesSettings :ignore-empty-points="true" argument-field="state" type="bar" /> <DxSeries value-field="oil" name="Oil Production" /> <DxSeries value-field="gas" name="Gas Production" /> <DxSeries value-field="coal" name="Coal Production" /> <DxLegend vertical-alignment="bottom" horizontal-alignment="center" /> <DxExport :enabled="true"/> </DxChart> </template> <script> import { DxChart, DxSeries, DxCommonSeriesSettings, DxLegend, DxExport } from 'devextreme-vue/chart'; import { dataSource } from './data.js'; export default { components: { DxChart, DxSeries, DxCommonSeriesSettings, DxLegend, DxExport }, data() { return { dataSource: dataSource }; } }; </script> <style> #chart { height: 440px; } </style>
import { createApp } from 'vue'; import App from './App.vue'; createApp(App).mount('#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/20.2.4/css/dx.common.css" /> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/20.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 = [{ state: 'China', oil: 4.95, gas: 2.85, coal: 45.56 }, { state: 'Russia', oil: 12.94, gas: 17.66, coal: 4.13 }, { state: 'USA', oil: 8.51, gas: 19.87, coal: 15.84 }, { state: 'Iran', oil: 5.3, gas: 4.39 }, { state: 'Canada', oil: 4.08, gas: 5.4 }, { state: 'Saudi Arabia', oil: 12.03 }, { state: 'Mexico', oil: 3.86 }];
System.config({ transpiler: 'plugin-babel', meta: { '*.vue': { loader: 'vue-loader' }, }, paths: { 'npm:': 'https://unpkg.com/' }, map: { 'vue': 'npm:vue@3.0.0/dist/vue.esm-browser.js', 'vue-loader': 'npm:dx-systemjs-vue-browser@1.0.15/index.js', 'mitt': 'npm:mitt/dist/mitt.umd.js', 'rrule': 'npm:rrule@2.6.6/dist/es5/rrule.js', 'luxon': 'npm:luxon@1.25.0/build/global/luxon.min.js', 'es6-object-assign': 'npm:es6-object-assign@1.1.0', 'devextreme': 'npm:devextreme@20.2.4', 'devextreme-vue': 'npm:devextreme-vue@20.2.4', 'jszip': 'npm:jszip@3.5.0/dist/jszip.min.js', 'devextreme-quill': 'npm:devextreme-quill@0.9.7/dist/dx-quill.min.js', 'devexpress-diagram': 'npm:devexpress-diagram@2.0.5/dist/dx-diagram.js', 'devexpress-gantt': 'npm:devexpress-gantt@2.0.8/dist/dx-gantt.js', 'preact': 'npm:preact@10.5.7/dist/preact.js', 'preact/hooks': 'npm:preact@10.5.7/hooks/dist/hooks.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' }, packages: { 'devextreme-vue': { main: 'index.js' }, 'devextreme': { defaultExtension: 'js' }, 'devextreme/events/utils': { main: 'index' }, 'devextreme/events': { main: 'index' }, 'es6-object-assign': { main: './index.js', defaultExtension: 'js' } }, babelOptions: { sourceMaps: false, stage0: true } });