DevExtreme v24.1 is now available.

Explore our newest features/capabilities and share your thoughts with us.

Your search did not match any results.

Side-by-Side Bar

This demo shows the standard bar series type that displays rectangular bars side by side. The side by side bar series help you compare values across different categories. Follow the steps below to create and configure the bar chart.
Backend API
$(() => { $('#chart').dxChart({ dataSource, commonSeriesSettings: { argumentField: 'state', type: 'bar', hoverMode: 'allArgumentPoints', selectionMode: 'allArgumentPoints', label: { visible: true, format: { type: 'fixedPoint', precision: 0, }, }, }, series: [ { valueField: 'year2018', name: '2018' }, { valueField: 'year2017', name: '2017' }, { valueField: 'year2016', name: '2016' }, ], title: 'Gross State Product within the Great Lakes Region', legend: { verticalAlignment: 'bottom', horizontalAlignment: 'center', }, export: { enabled: true, }, onPointClick(e) {; }, }); });
<!DOCTYPE html> <html xmlns="" lang="en"> <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=5.0" /> <script src=""></script> <script>window.jQuery || document.write(decodeURIComponent('%3Cscript src="js/jquery.min.js"%3E%3C/script%3E'))</script> <link rel="stylesheet" type="text/css" href="" /> <script src="js/dx.all.js"></script> <script src="data.js"></script> <link rel="stylesheet" type="text/css" href="styles.css" /> <script src="index.js"></script> </head> <body class="dx-viewport"> <div class="demo-container"> <div id="chart"></div> </div> </body> </html>
#chart { height: 440px; }
const dataSource = [{ state: 'Illinois', year2016: 803, year2017: 823, year2018: 863, }, { state: 'Indiana', year2016: 316, year2017: 332, year2018: 332, }, { state: 'Michigan', year2016: 452, year2017: 459, year2018: 470, }, { state: 'Ohio', year2016: 621, year2017: 642, year2018: 675, }, { state: 'Wisconsin', year2016: 290, year2017: 294, year2018: 301, }];

Bind to Data

In this demo, series is bound to data directly. See the Bind Series to Data article for information. The "state" field name is assigned to the argumentField property of the commonSeriesSettings object since the bar chart contains series with the same argument field.

Specify Common Series Settings

To configure settings for all series in the chart, use the commonSeriesSettings object.

You can configure the following series settings:

Customize Side by Side Chart

Use the verticalAlignment and horizontalAlignment properties of the legend object to specify the legend position in the chart.

You can also handle a series point selection in the pointClick event.

To allow a user to export your bar chart into the PNG, JPEG, and SVG file or print the chart, set the export.enabled property to true. In this demo, the exporting is enabled and you can click the "Exporting/Printing" button in the side by side bar chart. This button invokes a drop-down menu with export and print commands.