DevExtreme v24.1 is now available.

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

Your search did not match any results.

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
$(() => { const gauge = $('#gauge').dxCircularGauge({ scale: { startValue: 10, endValue: 40, tickInterval: 5, label: { customizeText(arg) { return `${arg.valueText} kV`; }, }, }, tooltip: { enabled: true }, title: { text: 'Generators Voltage (kV)', font: { size: 28 }, }, value: 34, subvalues: [12, 23], }).dxCircularGauge('instance'); const mainGenerator = $('#main-generator').dxNumberBox({ value: 34, min: 10, max: 40, width: 100, showSpinButtons: true, inputAttr: { 'aria-label': 'Main Generator' }, }).dxNumberBox('instance'); const additionalGeneratorOne = $('#additional-generator-one').dxNumberBox({ value: 12, min: 10, max: 40, width: 100, showSpinButtons: true, inputAttr: { 'aria-label': 'Additional Generator One' }, }).dxNumberBox('instance'); const additionalGeneratorTwo = $('#additional-generator-two').dxNumberBox({ value: 23, min: 10, max: 40, width: 100, showSpinButtons: true, inputAttr: { 'aria-label': 'Additional Generator Two' }, }).dxNumberBox('instance'); $('#edit').dxButton({ text: 'Apply', width: 100, onClick() { gauge.value(mainGenerator.option('value')); gauge.subvalues([additionalGeneratorOne.option('value'), additionalGeneratorTwo.option('value')]); }, }); });
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" 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" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script>window.jQuery || document.write(decodeURIComponent('%3Cscript src="js/jquery.min.js"%3E%3C/script%3E'))</script> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/24.1.3/css/dx.light.css" /> <script src="js/dx.all.js"></script> <link rel="stylesheet" type="text/css" href="styles.css" /> <script src="index.js"></script> </head> <body class="dx-viewport"> <div class="demo-container"> <div id="gauge-demo"> <div class="widget-container"> <div id="gauge"></div> </div> <div class="options"> <div class="caption">Options</div> <div class="option"> <span>Main generator</span> <div id="main-generator"></div> </div> <div class="option"> <span>Additional generator 1</span> <div id="additional-generator-one"></div> </div> <div class="option"> <span>Additional generator 2</span> <div id="additional-generator-two"></div> </div> <div class="option"> <div id="edit"></div> </div> </div> </div> </div> </body> </html>
.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; }