Your search did not match any results.
Linear Gauge

Variable Number of Subvalue Indicators

Documentation
This demo shows how to use the API of the LinearGauge to change its value and subvalue indicators at runtime. To get and set values of the indicators, the value and subvalues methods are utilized.
Copy to CodePen
Apply
Reset
var DemoApp = angular.module('DemoApp', ['dx']); DemoApp.controller('DemoController', function DemoController($scope) { $scope.gaugeValue = dataSource[0].primary; $scope.gaugeSubvalues = dataSource[0].secondary; $scope.linearGaugeOptions = { bindingOptions: { value: "gaugeValue", subvalues: "gaugeSubvalues" }, scale: { startValue: 0, endValue: 10, tickInterval: 2, label: { customizeText: function (arg) { return arg.valueText + " kW"; } } }, tooltip: { enabled: true, customizeTooltip: function (arg) { var result = arg.valueText + " kW"; if (arg.index >= 0) { result = "Secondary " + (arg.index + 1) + ": " + result; } else { result = "Primary: " + result; } return { text: result }; } }, "export": { enabled: true }, title: { text: "Power of Air Conditioners in Store Departments (kW)", font: { size: 28 } } }; $scope.selectBoxOptions = { dataSource: dataSource, displayExpr: "name", onValueChanged: function(e) { var value = e.value; $scope.gaugeValue = value.primary; $scope.gaugeSubvalues = value.secondary; }, value: dataSource[0], width: 200 }; });
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" > <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" /> <script src="js/jquery-3.1.0.min.js"></script> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/17.1.6/css/dx.spa.css" /> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/17.1.6/css/dx.common.css" /> <link rel="dx-theme" data-theme="generic.light" href="https://cdn3.devexpress.com/jslib/17.1.6/css/dx.light.css" /> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.16/angular.min.js"></script> <script>window.angular || document.write(decodeURIComponent('%3Cscript src="js/angular.min.js"%3E%3C\/script%3E'))</script> <script src="https://cdn3.devexpress.com/jslib/17.1.6/js/dx.all.js"></script> <script src="data.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" ng-app="DemoApp" ng-controller="DemoController"> <div id="gauge-demo"> <div id="gauge" dx-linear-gauge="linearGaugeOptions"></div> <div dx-select-box="selectBoxOptions"></div> </div> </div> </body> </html>
#gauge-demo { height: 440px; width: 100%; } #gauge { height: 400px; }
var dataSource = [{ name: 'Meat', primary: 8, secondary: [7, 3] }, { name: 'Fish', primary: 7, secondary: [7, 5, 1] }, { name: 'Grocery', primary: 5, secondary: [1, 3] }, { name: 'Greengrocery', primary: 3, secondary: [1] }, { name: 'Stationery', primary: 2, secondary: [] }];