Your search did not match any results.
Circular Gauge

Value Indicators API

Documentation

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
Apply
Reset
<template> <div> <div id="gauge-demo"> <div class="widget-container"> <dx-circular-gauge id="gauge" ref="gauge" > <dx-scale :start-value="10" :end-value="40" :tick-interval="5" > <dx-label :customize-text="customizeText" /> </dx-scale> <dx-tooltip :enabled="true" /> <dx-title text="Generators Voltage (kV)" > <dx-font :size="28" /> </dx-title> </dx-circular-gauge> </div> <div class="options"> <div class="caption">Options</div> <div class="option"> <span>Main generator</span> <dx-number-box id="main-generator" :value.sync="mainGeneratorValue" :min="10" :max="40" :width="100" :show-spin-buttons="true" /> </div> <div class="option"> <span>Additional generator 1</span> <dx-number-box id="additional-generator-one" :value.sync="additionalGenerator1Value" :min="10" :max="40" :width="100" :show-spin-buttons="true" /> </div> <div class="option"> <span>Additional generator 2</span> <dx-number-box id="additional-generator-two" :value.sync="additionalGenerator2Value" :min="10" :max="40" :width="100" :show-spin-buttons="true" /> </div> <div class="option"> <dx-button id="edit" :width="100" text="Apply" @click="updateValues" /> </div> </div> </div> </div> </template> <script> import { DxCircularGauge, DxScale, DxLabel, DxTooltip, DxTitle, DxFont } from 'devextreme-vue/circular-gauge'; import { DxNumberBox } from 'devextreme-vue/number-box'; import { DxButton } from 'devextreme-vue/button'; export default { components: { DxCircularGauge, DxScale, DxLabel, DxTooltip, DxTitle, DxFont, DxNumberBox, DxButton }, data() { return { additionalGenerator1Value: 12, additionalGenerator2Value: 23, mainGeneratorValue: 34 }; }, mounted() { this.updateValues(); }, methods: { customizeText({ valueText }) { return `${valueText} kV`; }, updateValues() { this.$refs.gauge.instance.value(this.mainGeneratorValue); this.$refs.gauge.instance.subvalues([this.additionalGenerator1Value, this.additionalGenerator2Value]); } } }; </script> <style scoped> .widget-container { margin-right: 320px; } .options { padding: 20px; background-color: rgba(191, 191, 191, 0.15); position: absolute; right: 0; top: 0; bottom: 0; width: 260px; } .caption { font-size: 18px; font-weight: 500; } .option { margin-top: 10px; } .option > span { display: inline-block; width: 155px; } .option > .dx-widget { display: inline-block; vertical-align: middle; } .option > .dx-button { float: right; } </style>
import Vue from 'vue'; import App from './App.vue'; new Vue({ el: '#app', components: { App }, template: '<App/>' });
<!DOCTYPE html> <html> <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="https://cdn3.devexpress.com/jslib/19.2.4/css/dx.common.css" /> <link rel="dx-theme" data-theme="generic.light" href="https://cdn3.devexpress.com/jslib/19.2.4/css/dx.light.css" /> <script src="https://unpkg.com/core-js@2.4.1/client/shim.min.js"></script> <script src="https://unpkg.com/systemjs@0.21.3/dist/system.js"></script> <script type="text/javascript" src="config.js"></script> <script type="text/javascript"> System.import('./index.js'); </script> </head> <body class="dx-viewport"> <div class="demo-container"> <div id="app"> </div> </div> </body> </html>
System.config({ transpiler: 'plugin-babel', paths: { 'npm:': 'https://unpkg.com/' }, map: { vue: 'npm:vue@2.5.16/dist/vue.esm.browser.js', 'vue-loader': 'npm:dx-systemjs-vue-browser@latest/index.js', 'devextreme': 'npm:devextreme@19.2', 'devextreme-vue': 'npm:devextreme-vue@19.2', jszip: 'npm:jszip@3.1.3/dist/jszip.min.js', 'quill': 'npm:quill@1.3.7/dist/quill.js', 'plugin-babel': 'npm:systemjs-plugin-babel@0/plugin-babel.js', 'systemjs-babel-build': 'npm:systemjs-plugin-babel@0/systemjs-babel-browser.js' }, meta: { '*.vue': { loader: 'vue-loader' } }, packages: { 'devextreme-vue': { main: 'index.js' }, 'devextreme': { defaultExtension: 'js' } }, babelOptions: { sourceMaps: false, stage0: true } });