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 - Strips

DevExtreme Chart can display background strips to better highlight a range of values.

To configure strips, declare an array of objects in the argumentAxis.strips[] or valueAxis.strips[] property. Each object in this array configures an individual strip. The startValue and endValue properties define the highlighted range.

This demo shows two value axis strips. The code configures label text and font.color properties for each strip.

Backend API
<dx-chart id="chart" [dataSource]="temperaturesData" title="Temperature (high) in September, &#176;F" [customizePoint]="customizePoint" [customizeLabel]="customizeLabel" > <dxi-chart-series argumentField="day" valueField="temperature" type="spline" color="#a3aaaa" ></dxi-chart-series> <dxi-chart-value-axis> <dxo-chart-label [customizeText]="customizeText"></dxo-chart-label> <dxi-chart-strip [startValue]="highAverage" color="rgba(255,155,85,0.15)"> <dxo-chart-label text="Above average high"> <dxo-chart-font [color]="highAverageColor"></dxo-chart-font> </dxo-chart-label> </dxi-chart-strip> <dxi-chart-strip [endValue]="lowAverage" color="rgba(97,153,230,0.10)"> <dxo-chart-label text="Below average low"> <dxo-chart-font [color]="lowAverageColor"></dxo-chart-font> </dxo-chart-label> </dxi-chart-strip> <dxo-chart-strip-style> <dxo-chart-label> <dxo-chart-font weight="500" size="14"></dxo-chart-font> </dxo-chart-label> </dxo-chart-strip-style> </dxi-chart-value-axis> <dxo-chart-legend [visible]="false"></dxo-chart-legend> <dxo-chart-export [enabled]="true"></dxo-chart-export> </dx-chart>
import { bootstrapApplication } from '@angular/platform-browser'; import { Component, enableProdMode, provideZoneChangeDetection } from '@angular/core'; import { DxChartModule, DxChartTypes } from 'devextreme-angular/ui/chart'; import { Service, Temperature } from './app.service'; if (!/localhost/.test(document.location.host)) { enableProdMode(); } const customizeText: DxChartTypes.ArgumentAxisLabel['customizeText'] = ({ valueText }) => `${valueText}&#176F`; @Component({ selector: 'demo-app', providers: [Service], templateUrl: './app.component.html', styleUrls: ['./app.component.css'], imports: [ DxChartModule, ], }) export class AppComponent { highAverageColor = '#ff9b52'; lowAverageColor = '#6199e6'; highAverage: number; lowAverage: number; temperaturesData: Temperature[]; constructor(service: Service) { this.temperaturesData = service.getTemperaturesData(); const { highAverage, lowAverage } = service.getRangeOfAverageTemperature(); this.highAverage = highAverage; this.lowAverage = lowAverage; } customizePoint: DxChartTypes.Properties['customizePoint'] = ({ value }) => { if (value > this.highAverage) { return { color: this.highAverageColor }; } if (value < this.lowAverage) { return { color: this.lowAverageColor }; } return null; }; customizeLabel: DxChartTypes.Properties['customizeLabel'] = ({ value }) => { if (value > this.highAverage) { return getLabelsSettings(this.highAverageColor); } if (value < this.lowAverage) { return getLabelsSettings(this.lowAverageColor); } return null; }; customizeText = customizeText; } function getLabelsSettings(backgroundColor: string) { return { visible: true, backgroundColor, customizeText, }; } bootstrapApplication(AppComponent, { providers: [ provideZoneChangeDetection({ eventCoalescing: true, runCoalescing: true }), ], });
::ng-deep #chart { height: 440px; }
import { Injectable } from '@angular/core'; export class Temperature { day: string; temperature: number; } const temperaturesData: Temperature[] = [ { temperature: 52, day: '1' }, { temperature: 57, day: '2' }, { temperature: 58, day: '3' }, { temperature: 56, day: '4' }, { temperature: 59, day: '5' }, { temperature: 59, day: '6' }, { temperature: 56, day: '7' }, { temperature: 62, day: '8' }, { temperature: 57, day: '9' }, { temperature: 54, day: '10' }, { temperature: 52, day: '11' }, { temperature: 58, day: '12' }, { temperature: 53, day: '13' }, { temperature: 54, day: '14' }, { temperature: 57, day: '15' }, { temperature: 61, day: '16' }, { temperature: 58, day: '17' }, { temperature: 63, day: '18' }, { temperature: 64, day: '19' }, { temperature: 52, day: '20' }, ]; @Injectable() export class Service { getTemperaturesData(): Temperature[] { return temperaturesData; } getRangeOfAverageTemperature() { return { highAverage: 60.8, lowAverage: 53, }; } }
<!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>

You can specify the same appearance for all strips on a specific axis or in the Chart. To specify the same appearance, declare the stripStyle object in the valueAxis, argumentAxis, or commonAxisSettings object. Individual settings override common settings. In this example, we used the stripStyle object to specify the font weight and size for all strip labels on the value axis.