-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathDevExtremeGauge.razor.js
39 lines (36 loc) · 1.23 KB
/
DevExtremeGauge.razor.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
export async function initializeGauge(element, datasource) {
const value = !!datasource ? datasource.mean : null;
const subValues = !!datasource ? [ datasource.min, datasource.max] : [ ];
return new DevExpress.viz.dxCircularGauge(element, {
scale: {
startValue: 10,
endValue: 40,
tickInterval: 5,
label: {
customizeText(arg) {
return `${arg.valueText} °C`;
},
},
},
rangeContainer: {
ranges: [
{ startValue: 10, endValue: 20, color: '#0077BE' },
{ startValue: 20, endValue: 30, color: '#E6E200' },
{ startValue: 30, endValue: 40, color: '#77DD77' },
],
},
tooltip: { enabled: true },
title: {
text: 'Temperature in the Greenhouse',
font: { size: 28 },
},
value: value,
subvalues: subValues
});
}
export async function changeGaugeDataSource(gauge, datasource) {
const value = !!datasource ? datasource.mean : null;
const subValues = !!datasource ? [ datasource.min, datasource.max] : [ ];
gauge.value(value);
gauge.subvalues(subValues);
}