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 Gauges - Circular Gauge

This demo illustrates how to bind an array of subvalues to the CircularGauge. Since an array can not be bound to a field as a regular value, it is bound as a computed one.

Backend API
<div id="gauge-demo"> <dx-circular-gauge id="gauge" [value]="value.mean" [subvalues]="[value.min, value.max]" > <dxo-circular-gauge-range-container> <dxi-circular-gauge-range [startValue]="10" [endValue]="20" color="#0077BE" ></dxi-circular-gauge-range> <dxi-circular-gauge-range [startValue]="20" [endValue]="30" color="#E6E200" ></dxi-circular-gauge-range> <dxi-circular-gauge-range [startValue]="30" [endValue]="40" color="#77DD77" ></dxi-circular-gauge-range> </dxo-circular-gauge-range-container> <dxo-circular-gauge-scale [startValue]="10" [endValue]="40" [tickInterval]="5" > <dxo-circular-gauge-label [customizeText]="customizeText" ></dxo-circular-gauge-label> </dxo-circular-gauge-scale> <dxo-circular-gauge-tooltip [enabled]="true"></dxo-circular-gauge-tooltip> <dxo-circular-gauge-title text="Temperature in the Greenhouse"> <dxo-circular-gauge-font [size]="28"></dxo-circular-gauge-font> </dxo-circular-gauge-title> </dx-circular-gauge> <dx-select-box #seasons id="seasons" [dataSource]="dataSource" [inputAttr]="{ 'aria-label': 'Season' }" [width]="150" displayExpr="name" [(value)]="value" > </dx-select-box> </div>
import { bootstrapApplication } from '@angular/platform-browser'; import { Component, enableProdMode, provideZoneChangeDetection } from '@angular/core'; import { DxCircularGaugeModule, DxSelectBoxModule } from 'devextreme-angular'; import { Data, 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: [ DxCircularGaugeModule, DxSelectBoxModule, ], }) export class AppComponent { dataSource: Data[]; value: Data; constructor(service: Service) { this.dataSource = service.getData(); this.value = this.dataSource[0]; } customizeText(arg) { return `${arg.valueText} °C`; } } bootstrapApplication(AppComponent, { providers: [ provideZoneChangeDetection({ eventCoalescing: true, runCoalescing: true }), ], });
::ng-deep #gauge-demo { height: 440px; width: 100%; } ::ng-deep #gauge { width: 80%; height: 100%; float: left; } ::ng-deep #seasons { width: 20%; float: left; text-align: left; margin-top: 20px; }
import { Injectable, } from '@angular/core'; export class Data { name: string; mean: number; min: number; max: number; } const dataSource: Data[] = [{ name: 'Summer', mean: 35, min: 28, max: 38, }, { name: 'Autumn', mean: 24, min: 20, max: 32, }, { name: 'Winter', mean: 18, min: 16, max: 23, }, { name: 'Spring', mean: 27, min: 18, max: 31, }]; @Injectable() export class Service { getData(): Data[] { return dataSource; } }
<!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>