-
Data Grid
- Overview
-
Data Binding
-
Paging and Scrolling
-
Editing
-
Grouping
-
Filtering and Sorting
- Focused Row
-
Row Drag & Drop
-
Selection
-
Columns
- State Persistence
-
Appearance
-
Templates
-
Data Summaries
-
Master-Detail
-
Export to PDF
-
Export to Excel
-
Adaptability
- Keyboard Navigation
-
Pivot Grid
- Overview
-
Data Binding
-
Field Chooser
-
Features
-
Export to Excel
-
Tree List
- Overview
-
Data Binding
- Sorting
- Paging
-
Editing
- Node Drag & Drop
- Focused Row
-
Selection
-
Filtering
-
Column Customization
- State Persistence
- Adaptability
- Keyboard Navigation
-
Scheduler
- Overview
-
Data Binding
-
Views
-
Features
- Virtual Scrolling
-
Grouping
-
Customization
- Adaptability
-
Html Editor
-
Chat
-
Diagram
- Overview
-
Data Binding
-
Featured Shapes
-
Custom Shapes
-
Document Capabilities
-
User Interaction
- UI Customization
- Adaptability
-
Charts
- Overview
-
Data Binding
-
Area Charts
-
Bar Charts
- Bullet Charts
-
Doughnut Charts
-
Financial Charts
-
Line Charts
-
Pie Charts
-
Point Charts
-
Polar and Radar Charts
-
Range Charts
-
Sparkline Charts
-
Tree Map
-
Funnel and Pyramid Charts
- Sankey Chart
-
Combinations
-
More Features
-
Export
-
Selection
-
Tooltips
-
Zooming
-
-
Gantt
- Overview
-
Data
-
UI Customization
- Strip Lines
- Export to PDF
- Sorting
-
Filtering
-
Gauges
- Overview
-
Data Binding
-
Bar Gauge
-
Circular Gauge
-
Linear Gauge
-
Navigation
- Overview
- Accordion
-
Menu
- Multi View
-
Drawer
-
Tab Panel
-
Tabs
-
Toolbar
- Pagination
-
Tree View
- Right-to-Left Support
-
Layout
-
Editors
- Overview
- Autocomplete
-
Calendar
- Check Box
- Color Box
-
Date Box
-
Date Range Box
-
Drop Down Box
-
Number Box
-
Select Box
- Switch
-
Tag Box
- Text Area
- Text Box
- Validation
- Custom Text Editor Buttons
- Right-to-Left Support
- Editor Appearance Variants
-
Forms and Multi-Purpose
- Overview
- Button Group
- Field Set
-
Filter Builder
-
Form
- Radio Group
-
Range Selector
- Numeric Scale (Lightweight)
- Numeric Scale
- Date-Time Scale (Lightweight)
- Date-Time Scale
- Logarithmic Scale
- Discrete scale
- Custom Formatting
- Use Range Selection for Calculation
- Use Range Selection for Filtering
- Image on Background
- Chart on Background
- Customized Chart on Background
- Chart on Background with Series Template
- Range Slider
- Slider
-
Sortable
-
File Management
-
File Manager
- Overview
-
File System Types
-
Customization
-
File Uploader
-
-
Actions and Lists
- Overview
-
Action Sheet
-
Button
- Floating Action Button
- Drop Down Button
-
Context Menu
-
List
-
Lookup
-
Maps
- Overview
-
Map
-
Vector Map
-
Dialogs and Notifications
-
Localization
JavaScript/jQuery Charts - Bi-Directional Bar Chart
To create a bi-directional bar chart, follow the steps below.
If you have technical questions, please create a support ticket in the DevExpress Support Center.
$(() => {
$('#chart').dxChart({
title: 'Population Pyramid For Norway 2016',
dataSource,
rotated: true,
barGroupWidth: 18,
commonSeriesSettings: {
type: 'stackedbar',
argumentField: 'age',
},
series: [{
valueField: 'male',
name: 'Male',
color: '#3F7FBF',
}, {
valueField: 'female',
name: 'Female',
color: '#F87CCC',
}],
tooltip: {
enabled: true,
customizeTooltip() {
return {
text: Math.abs(this.valueText),
};
},
},
valueAxis: {
label: {
customizeText() {
return `${Math.abs(this.value)}%`;
},
},
},
legend: {
verticalAlignment: 'bottom',
horizontalAlignment: 'center',
margin: { left: 50 },
},
});
});
xxxxxxxxxx
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>↔</head>
<body class="dx-viewport">
<div class="demo-container">
<div id="chart"></div>
</div>
</body>
</html>
xxxxxxxxxx
#chart {
height: 549px;
width: 820px;
margin: 0 auto;
}
xxxxxxxxxx
const dataSource = [{
age: '0-4',
male: -3.1,
female: 2.9,
}, {
age: '5-9',
male: -3.1,
female: 3.0,
}, {
age: '10-14',
male: -3.0,
female: 2.9,
}, {
age: '15-19',
male: -3.2,
female: 3.0,
}, {
age: '20-24',
male: -3.5,
female: 3.3,
}, {
age: '25-29',
male: -3.5,
female: 3.4,
}, {
age: '30-34',
male: -3.5,
female: 3.3,
}, {
age: '35-39',
male: -3.3,
female: 3.1,
}, {
age: '40-44',
male: -3.7,
female: 3.4,
}, {
age: '45-49',
male: -3.8,
female: 3.5,
}, {
age: '50-54',
male: -3.4,
female: 3.2,
}, {
age: '55-59',
male: -3.1,
female: 3.0,
}, {
age: '60-64',
male: -2.7,
female: 2.7,
}, {
age: '65-69',
male: -2.9,
female: 2.9,
}, {
age: '70-74',
male: -2,
female: 2.1,
}, {
age: '75-79',
male: -1.2,
female: 1.4,
}, {
age: '80-84',
male: -0.8,
female: 1.2,
}, {
age: '85-89',
male: -0.5,
female: 0.8,
}, {
age: '90-94',
male: -0.2,
female: 0.5,
}, {
age: '95+',
male: 0,
female: 0.1,
}];
-
Convert half of the data source values from positive to negative. In this demo, the
male
percentages are negative, while thefemale
are positive. -
Implement a rotated stacked bar chart. Use the commonSeriesSettings object to specify the type and the argumentField property (
age
in this case). Set the rotated property totrue
. -
Declare two objects in the series array: one for negative values, the other for positive. Specify the color, name, and valueField for each series.
-
Change the label text of the valueAxis so that the negative values appear as positive. To implement this technique, use the customizeText function.
To further customize your bi-directional bar chart, implement tooltips and change the legend's alignment.