Your search did not match any results.
Circular Gauge

Value Indicators API


This demo shows how to use the API of the CircularGauge to change its value and subvalue indicators at runtime. To get and set the values of the indicators, the value and subvalues methods are utilized.

Copy to CodeSandBox
<div id="gauge-demo"> <div class="widget-container"> <dx-circular-gauge id="gauge" [value]="gaugeValue" [subvalues]="gaugeSubvalues"> <dxo-scale [startValue]="10" [endValue]="40" [tickInterval]="5"> <dxo-label [customizeText]="customizeText"></dxo-label> </dxo-scale> <dxo-title text="Generators Voltage (kV)"> <dxo-font [size]="28"></dxo-font> </dxo-title> <dxo-tooltip [enabled]="true"></dxo-tooltip> </dx-circular-gauge> </div> <div class="options"> <div class="caption">Options</div> <div class="option"> <span>Main generator</span> <dx-number-box [(value)]="mainGenerator" [min]="10" [max]="40" [width]="100" [showSpinButtons]="true"> </dx-number-box> </div> <div class="option"> <span>Additional generator 1</span> <dx-number-box [(value)]="additionalGenerator[0]" [min]="10" [max]="40" [width]="100" [showSpinButtons]="true"> </dx-number-box> </div> <div class="option"> <span>Additional generator 2</span> <dx-number-box [(value)]="additionalGenerator[1]" [min]="10" [max]="40" [width]="100" [showSpinButtons]="true"> </dx-number-box> </div> <div class="option"> <dx-button text="Apply" [width]="100" (onClick)="updateValues()"> </dx-button> </div> </div> </div>
import { NgModule, Component, enableProdMode } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { DxCircularGaugeModule, DxNumberBoxModule, DxButtonModule } from 'devextreme-angular' if(!/localhost/.test( { enableProdMode(); } @Component({ selector: 'demo-app', templateUrl: 'app/app.component.html', styleUrls: ['app/app.component.css'] }) export class AppComponent { mainGenerator = 34; additionalGenerator: number[] = [12, 23]; gaugeValue = 34; gaugeSubvalues: number[] = [12, 23]; customizeText(arg: any) { return arg.valueText + " kV"; } updateValues() { this.gaugeValue = this.mainGenerator; this.gaugeSubvalues = this.additionalGenerator.slice(); } } @NgModule({ imports: [ BrowserModule, DxCircularGaugeModule, DxNumberBoxModule, DxButtonModule ], declarations: [AppComponent], bootstrap: [AppComponent] }) export class AppModule { } platformBrowserDynamic().bootstrapModule(AppModule);
::ng-deep .widget-container { margin-right: 320px; } ::ng-deep .options { padding: 20px; background-color: rgba(191, 191, 191, 0.15); position: absolute; right: 0; top: 0; bottom: 0; width: 260px; } ::ng-deep .caption { font-size: 18px; font-weight: 500; } ::ng-deep .option { margin-top: 10px; } ::ng-deep .option > span { width: 155px; line-height: 36px; } ::ng-deep .option > .dx-widget { float: right; }
// In real applications, you should not transpile code in the browser. You can see how to create your own application with Angular and DevExtreme here: // System.config({ transpiler: 'ts', typescriptOptions: { module: "system", emitDecoratorMetadata: true, experimentalDecorators: true }, meta: { 'typescript': { "exports": "ts" }, }, paths: { 'npm:': '' }, map: { 'ts': 'npm:plugin-typescript@8.0.0/lib/plugin.js', 'typescript': 'npm:typescript@3.4.5/lib/typescript.js', '@angular': 'npm:@angular', 'tslib': 'npm:tslib/tslib.js', 'rxjs': 'npm:rxjs', 'devextreme': 'npm:devextreme@20.1', 'jszip': 'npm:jszip@3.1.3/dist/jszip.min.js', 'quill': 'npm:quill@1.3.7/dist/quill.js', 'devexpress-diagram': 'npm:devexpress-diagram@1.0.17', 'devexpress-gantt': 'npm:devexpress-gantt@1.0.10', 'devextreme-angular': 'npm:devextreme-angular@20.1' }, packages: { 'app': { main: './app.component.ts', defaultExtension: 'ts' }, 'devextreme': { defaultExtension: 'js' }, 'devextreme/events/utils': { main: 'index' }, 'devextreme/events': { main: 'index' }, }, packageConfigPaths: [ "npm:*/package.json", "npm:@angular/*/package.json", "npm:@angular/common/*/package.json", "npm:rxjs/operators/package.json", "npm:devextreme-angular@20.1/*/package.json", "npm:devextreme-angular@20.1/ui/*/package.json", ] });
<!DOCTYPE html> <html xmlns=""> <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=1.0" /> <link rel="stylesheet" type="text/css" href="" /> <link rel="stylesheet" type="text/css" href="" /> <script src=""></script> <script src=""></script> <script src=""></script> <script src=""></script> <script src="config.js"></script> <script> System.import('app').catch(console.error.bind(console)); </script> </head> <body class="dx-viewport"> <div class="demo-container"> <demo-app>Loading...</demo-app> </div> </body> </html>