Your search did not match any results.
Charts

Pareto Chart

In this demo, the DevExtreme Chart widget is used to create a Pareto chart. This example of a Pareto chart summarizes complaints about the service provided by a pizza shop. From this chart, the pizza shop owner may infer that to satisfy most of the customers, he or she needs to eliminate two most frequently encountered issues: delayed delivery and cold pizza.

Apply
Reset
import React from 'react'; import Chart, { ArgumentAxis, CommonSeriesSettings, Legend, Series, Tooltip, ValueAxis, ConstantLine, Label } from 'devextreme-react/chart'; import { complaintsData } from './data.js'; class App extends React.Component { render() { return ( <Chart title={'Pizza Shop Complaints'} dataSource={dataArray} palette={'Harmony Light'} id={'chart'} > <ArgumentAxis> <Label overlappingBehavior={'stagger'} /> </ArgumentAxis> <ValueAxis name={'frequency'} position={'left'} tickInterval={300} /> <ValueAxis name={'percentage'} position={'right'} tickInterval={20} showZero={true} valueMarginsEnabled={false} > <Label customizeText={customizePercentageText} /> <ConstantLine value={80} width={2} color={'#fc3535'} dashStyle={'dash'}> <Label visible={false} /> </ConstantLine> </ValueAxis> <Series name={'Complaint frequency'} valueField={'count'} axis={'frequency'} type={'bar'} color={'#fac29a'} /> <Series name={'Cumulative percentage'} valueField={'cumulativePercentage'} axis={'percentage'} type={'spline'} color={'#6b71c3'} /> <Tooltip enabled={true} shared={true} customizeTooltip={customizeTooltip} /> <Legend verticalAlignment={'top'} horizontalAlignment={'center'} /> <CommonSeriesSettings argumentField={'complaint'} /> </Chart> ); } } const data = complaintsData.sort(function(a, b) { return b.count - a.count; }); const totalCount = data.reduce(function(prevValue, item) { return prevValue + item.count; }, 0); let cumulativeCount = 0; const dataArray = data.map(function(item) { cumulativeCount += item.count; return { complaint: item.complaint, count: item.count, cumulativePercentage: Math.round(cumulativeCount * 100 / totalCount) }; }); const customizeTooltip = function(info) { return { html: `<div><div class="tooltip-header">${ info.argumentText }</div><div class="tooltip-body"><div class="series-name">${ info.points[0].seriesName }: </div><div class="value-text">${ info.points[0].valueText }</div><div class="series-name">${ info.points[1].seriesName }: </div><div class="value-text">${ info.points[1].valueText }% </div></div></div>` }; }; function customizePercentageText(info) { return `${info.valueText}%`; } 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.3/css/dx.common.css" /> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/19.2.3/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; } .tooltip-header { margin-bottom: 5px; font-size: 16px; font-weight: 500; padding-bottom: 5px; border-bottom: 1px solid #c5c5c5; } .tooltip-body { width: 170px; } .tooltip-body .series-name { font-weight: normal; opacity: 0.6; display: inline-block; line-height: 1.5; padding-right: 10px; width: 126px; } .tooltip-body .value-text { display: inline-block; line-height: 1.5; width: 30px; }
export const complaintsData = [ { complaint: 'Cold pizza', count: 780 }, { complaint: 'Not enough cheese', count: 120 }, { complaint: 'Underbaked or Overbaked', count: 52 }, { complaint: 'Delayed delivery', count: 1123 }, { complaint: 'Damaged pizza', count: 321 }, { complaint: 'Incorrect billing', count: 89 }, { complaint: 'Wrong size delivered', count: 222 } ];
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 } });