DevExtreme v26.1 is now available.

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

Your search did not match any results.

Angular Charts - Range Bar

This demo illustrates the range bar series type.

You can use range bars to display value ranges that correspond to specified arguments. Each point in a range bar series has one argument and two values. The argumentField supplies arguments while the rangeValue1Field and rangeValue2Field supply bar start and end point values.

Backend API
<dx-chart id="chart" palette="violet" title="Crude Oil Prices in 2024" [dataSource]="oilPrices" > <dxo-chart-common-series-settings argumentField="date" type="rangeBar" [minBarSize]="2" ></dxo-chart-common-series-settings> <dxi-chart-value-axis> <dxo-chart-title text="$ per barrel"></dxo-chart-title> </dxi-chart-value-axis> <dxo-chart-argument-axis> <dxo-chart-label format="month"></dxo-chart-label> </dxo-chart-argument-axis> <dxo-chart-export [enabled]="true"></dxo-chart-export> <dxo-chart-legend verticalAlignment="bottom" horizontalAlignment="center" ></dxo-chart-legend> <dxi-chart-series rangeValue1Field="aVal1" rangeValue2Field="aVal2" name="ANS West Coast" ></dxi-chart-series> <dxi-chart-series rangeValue1Field="tVal1" rangeValue2Field="tVal2" name="West Texas Intermediate" ></dxi-chart-series> <dxo-chart-tooltip [enabled]="true"></dxo-chart-tooltip> </dx-chart>
import { bootstrapApplication } from '@angular/platform-browser'; import { Component, enableProdMode, provideZoneChangeDetection } from '@angular/core'; import { DxChartModule } from 'devextreme-angular'; import { OilPrice, Service } from './app.service'; if (!/localhost/.test(document.location.host)) { enableProdMode(); } @Component({ selector: 'demo-app', templateUrl: './app.component.html', styleUrls: ['./app.component.css'], providers: [Service], imports: [ DxChartModule, ], }) export class AppComponent { oilPrices: OilPrice[]; constructor(service: Service) { this.oilPrices = service.getOilPrices(); } } bootstrapApplication(AppComponent, { providers: [ provideZoneChangeDetection({ eventCoalescing: true, runCoalescing: true }), ], });
::ng-deep #chart { height: 440px; }
import { Injectable, } from '@angular/core'; export class OilPrice { date: Date; aVal1: number; aVal2: number; tVal1: number; tVal2: number; } const oilPrices: OilPrice[] = [{ date: new Date(2024, 0, 1), aVal1: 72, aVal2: 78, tVal1: 70, tVal2: 74, }, { date: new Date(2024, 1, 1), aVal1: 74, aVal2: 80, tVal1: 73, tVal2: 77, }, { date: new Date(2024, 2, 1), aVal1: 78, aVal2: 84, tVal1: 78, tVal2: 81, }, { date: new Date(2024, 3, 1), aVal1: 82, aVal2: 90, tVal1: 82, tVal2: 85, }, { date: new Date(2024, 4, 1), aVal1: 77, aVal2: 84, tVal1: 77, tVal2: 80, }, { date: new Date(2024, 5, 1), aVal1: 76, aVal2: 83, tVal1: 78, tVal2: 80, }, { date: new Date(2024, 6, 1), aVal1: 78, aVal2: 86, tVal1: 80, tVal2: 82, }, { date: new Date(2024, 7, 1), aVal1: 73, aVal2: 81, tVal1: 74, tVal2: 77, }, { date: new Date(2024, 8, 1), aVal1: 67, aVal2: 74, tVal1: 68, tVal2: 70, }, { date: new Date(2024, 9, 1), aVal1: 69, aVal2: 76, tVal1: 70, tVal2: 72, }, { date: new Date(2024, 10, 1), aVal1: 67, aVal2: 73, tVal1: 68, tVal2: 70, }, { date: new Date(2024, 11, 1), aVal1: 68, aVal2: 74, tVal1: 69, tVal2: 71, }]; @Injectable() export class Service { getOilPrices(): OilPrice[] { return oilPrices; } }
<!DOCTYPE html> <html 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" /> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/26.1.5/css/dx.light.css" /> </head> <body class="dx-viewport"> <div class="demo-container"> <demo-app>Loading...</demo-app> </div> <script src="https://cdn.jsdelivr.net/npm/zone.js@0.16.2/bundles/zone.umd.js"></script> <script src="./bundle.js" type="module"></script> </body> </html>

To create multiple range bar series, use the series array to declare each series and the commonSeriesSettings object to specify the common series type. In this object, you can implement parameters specific to the range bar series type. For example, this demo specifies a minimum bar size for all series.