DevExtreme v26.1 is now available.

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

Your search did not match any results.

Vue Gauges - 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.

Backend API
<template> <div> <div id="gauge-demo"> <div class="widget-container"> <DxCircularGauge ref="gauge" > <DxScale :start-value="10" :end-value="40" :tick-interval="5" > <DxLabel :customize-text="customizeText" /> </DxScale> <DxTooltip :enabled="true" /> <DxTitle text="Generators Voltage (kV)" > <DxFont :size="28" /> </DxTitle> </DxCircularGauge> </div> <div class="options"> <div class="caption">Options</div> <div class="option"> <span>Main generator</span> <DxNumberBox id="main-generator" v-model:value="mainGeneratorValue" :min="10" :max="40" :width="100" :show-spin-buttons="true" :input-attr="{ 'aria-label': 'Main Generator' }" /> </div> <div class="option"> <span>Additional generator 1</span> <DxNumberBox id="additional-generator-one" v-model:value="additionalGenerator1Value" :min="10" :max="40" :width="100" :show-spin-buttons="true" :input-attr="{ 'aria-label': 'Additional Generator One' }" /> </div> <div class="option"> <span>Additional generator 2</span> <DxNumberBox id="additional-generator-two" v-model:value="additionalGenerator2Value" :min="10" :max="40" :width="100" :show-spin-buttons="true" :input-attr="{ 'aria-label': 'Additional Generator Two' }" /> </div> <div class="option"> <DxButton id="edit" :width="100" text="Apply" @click="updateValues" /> </div> </div> </div> </div> </template> <script setup lang="ts"> import { onMounted, ref } from 'vue'; 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'; const additionalGenerator1Value = ref(12); const additionalGenerator2Value = ref(23); const mainGeneratorValue = ref(34); const gauge = ref(); const customizeText = ({ valueText }: Record<string, any>) => `${valueText} kV`; onMounted(() => { updateValues(); }); function updateValues() { gauge.value.instance.value(mainGeneratorValue.value); gauge.value.instance.subvalues([ additionalGenerator1Value.value, additionalGenerator2Value.value, ]); } </script> <style> .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; display: flex; align-items: center; justify-content: space-between; } #edit { margin-left: auto; } </style>
import { createApp } from 'vue'; import App from './App.vue'; createApp(App).mount('#app');
<!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" /> <link rel="stylesheet" type="text/css" href="./bundle.css" /> </head> <body class="dx-viewport"> <div class="demo-container"> <div id="app"> </div> </div> <script src="bundles/vendor/vue.vendor.js"></script> <script src="./bundle.js"></script> </body> </html>