Your search did not match any results.
Bar Charts

Scale Breaks

Documentation

Scale breaks allow breaking off parts of the axis to improve the readability of a chart with high amplitude values. This example demonstrates auto-calculated scale breaks. You can change the number of breaks, their style or disabled them.

Copy to CodeSandBox
Apply
Reset
import React from 'react'; import Chart, { Legend, Series, Tooltip, ValueAxis } from 'devextreme-react/chart'; import SelectBox from 'devextreme-react/select-box'; import CheckBox from 'devextreme-react/check-box'; import { dataSource } from './data.js'; const lineStyles = ['waved', 'straight']; const breaksCount = [1, 2, 3, 4]; class App extends React.Component { constructor(props) { super(props); this.state = { autoBreaksEnabledValue: true, breaksCountValue: 3, lineStyleValue: lineStyles[0] }; this.changeBreaksCount = (e) => { this.setState({ breaksCountValue: e.value }); }; this.changeStyle = (e) => { this.setState({ lineStyleValue: e.value }); }; this.changeBreaksEnabledState = (e) => { this.setState({ autoBreaksEnabledValue: e.value }); }; } render() { return ( <div> <Chart id="chart" title={'Relative Masses of the Heaviest\n Solar System Objects'} dataSource={dataSource}> <Series valueField="mass" argumentField="name" type="bar" /> <ValueAxis visible={true} autoBreaksEnabled={this.state.autoBreaksEnabledValue} maxAutoBreakCount={this.state.breaksCountValue} breakStyle={{ line: this.state.lineStyleValue }} /> <Legend visible={false} /> <Tooltip enabled={true} /> </Chart> <div className="options"> <div className="caption">Options</div> <div className="option"> <CheckBox className="checkbox" text="Enable Breaks" onValueChanged={this.changeBreaksEnabledState} value={this.state.autoBreaksEnabledValue}> </CheckBox> </div> &nbsp; <div className="option center"> <span>Max Count </span> <SelectBox items={breaksCount} value={this.state.breaksCountValue} onValueChanged={this.changeBreaksCount} width={60}> </SelectBox> </div> &nbsp; <div className="option right"> <span>Style </span> <SelectBox items={lineStyles} value={this.state.lineStyleValue} onValueChanged={this.changeStyle} width={120}> </SelectBox> </div> </div> </div> ); } } export default App;
import React from 'react'; import ReactDOM from 'react-dom'; import App from './App.js'; ReactDOM.render( <App />, document.getElementById('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="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/19.2.4/css/dx.light.css" /> <link rel="stylesheet" type="text/css" href="styles.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>
#chart { height: 440px; } .options { padding: 20px; background-color: rgba(191, 191, 191, 0.15); margin-top: 20px; } .caption { font-size: 18px; font-weight: 500; } .option { display: inline-block; margin-right: 70px; margin-top: 5px; } .option > span { margin: 0 10px 0 0; } .checkbox{ margin-top: -4px; } .option > .dx-widget { display: inline-block; vertical-align: middle; }
export const dataSource = [{ name: 'Jupiter', mass: 318, }, { name: 'Saturn', mass: 95, }, { name: 'Uranus', mass: 14.6, }, { name: 'Neptune', mass: 17.2, }, { name: 'Earth', mass: 1, }, { name: 'Venus', mass: 0.82, }, { name: 'Mars', mass: 0.11, }, { name: 'Mercury', mass: 0.06, }];
System.config({ transpiler: 'plugin-babel', paths: { 'npm:': 'https://unpkg.com/' }, defaultExtension: 'js', map: { 'react': 'npm:react@16/umd/react.development.js', 'react-dom': 'npm:react-dom@16/umd/react-dom.development.js', 'prop-types': 'npm:prop-types/prop-types.js', 'devextreme': 'npm:devextreme@19.2', 'devextreme-react': 'npm:devextreme-react@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', // SystemJS plugins 'plugin-babel': 'npm:systemjs-plugin-babel@0/plugin-babel.js', 'systemjs-babel-build': 'npm:systemjs-plugin-babel@0/systemjs-babel-browser.js' }, packages: { 'devextreme': { defaultExtension: 'js' }, 'devextreme-react': { main: 'index.js' } }, babelOptions: { sourceMaps: false, stage0: true, react: true } });