var DemoApp = angular.module('DemoApp', ['dx']);
DemoApp.controller('DemoController', function DemoController($scope) {
$scope.mainGenerator = 34;
$scope.subValueOne = 12;
$scope.subValueTwo = 23;
$scope.additionalGenerators = [12, 23];
$scope.gauge = {
value: $scope.mainGenerator,
subvalues: $scope.additionalGenerators
};
$scope.gaugeOptions = {
bindingOptions: {
value: "gauge.value",
subvalues: "gauge.subvalues"
},
scale: {
startValue: 10,
endValue: 40,
tickInterval: 5,
label: {
customizeText: function (arg) {
return arg.valueText + " kV";
}
}
},
tooltip: { enabled: true },
title: {
text: "Generators Voltage (kV)",
font: { size: 28 }
}
};
$scope.mainGeneratorOptions = {
bindingOptions: {
value: "mainGenerator"
},
min: 10,
max: 40,
width: 100,
showSpinButtons: true
};
$scope.additionalGeneratorOne = {
bindingOptions: {
value: "subValueOne"
},
min: 10,
max: 40,
width: 100,
showSpinButtons: true
};
$scope.additionalGeneratorTwo = {
bindingOptions: {
value: "subValueTwo"
},
min: 10,
max: 40,
width: 100,
showSpinButtons: true
};
$scope.editButton = {
text: "Apply",
width: 100,
onClick: function(e) {
$scope.additionalGenerators = [$scope.subValueOne, $scope.subValueTwo];
$scope.gauge = {
value: $scope.mainGenerator,
subvalues: $scope.additionalGenerators
};
}
};
});
<!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="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/20.2.6/css/dx.common.css" />
<link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/20.2.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/20.2.6/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" ng-app="DemoApp" ng-controller="DemoController">
<div id="gauge-demo">
<div class="widget-container">
<div id="gauge" dx-circular-gauge="gaugeOptions"></div>
</div>
<div class="options">
<div class="caption">Options</div>
<div class="option">
<span>Main generator</span>
<div dx-number-box="mainGeneratorOptions"></div>
</div>
<div class="option">
<span>Additional generator 1</span>
<div dx-number-box="additionalGeneratorOne"></div>
</div>
<div class="option">
<span>Additional generator 2</span>
<div dx-number-box="additionalGeneratorTwo"></div>
</div>
<div class="option">
<div dx-button="editButton"></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;
}
.option > span {
width: 155px;
line-height: 36px;
}
.option > .dx-widget {
float: right;
}