-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathui-artless-gauge.html
700 lines (635 loc) · 29.4 KB
/
ui-artless-gauge.html
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
<!--
MIT License
Copyright (c) 2020 hotNipi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the 'Software'), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-->
<script type='text/javascript'>
var ARTLESS_ERR_MINMAX = "MIN should be less than MAX!"
var ARTLESS_ERR_UNIQUE = "All values must be unique!"
var ARTLESS_ERR_SOME_NAN = "Bad sector configuration!"
var ARTLESS_ERR_SOME_OVER = "Sector out of range!"
RED.nodes.registerType('ui_artlessgauge', {
category: 'dashboard',
color: 'rgb( 63, 173, 181)',
configError: '',
defaults: {
group: { type: 'ui_group', required: true },
order: { value: 0 },
width: {
value: 0,
validate: function (v) {
var valid = true
var width = v || 0;
var currentGroup = $('#node-input-group').val() || this.group;
var groupNode = RED.nodes.node(currentGroup);
valid = !groupNode || +width <= +groupNode.width;
$('#node-input-size').toggleClass('input-error', !valid);
return valid;
}
},
height: { value: 0 },
name: { value: '' },
icon: { value: '' },
label: { value: 'Gauge' },
unit: { value: '' },
layout: { value: 'linear' },
decimals: { value: 0, required: false, validate: RED.validators.number() },
differential: { value: false },
minmax: { value: false },
colorTrack: { value: '#555555' },
style: { value: '' },
colorFromTheme: { value: true },
property: { value: "payload", required: true },
secondary: { value: "secondary", required: false },
inline:{value:false},
animate:{value:true, required: true},
sectors: {
value: [{ val: 0, col: '#ff9900', t: "min", dot: 0 }, { val: 10, col: '#ff9900', t: "max", dot: 0 }],
validate: function (v) {
configError = ""
var unique = [...new Set(v.map(s => s.val))]
var valid = true
var mi = v.find(el => el.t == 'min')
var ma = v.find(el => el.t == 'max')
if (mi.val > ma.val) {
configError = ARTLESS_ERR_MINMAX
valid = false
} else if (v.length != unique.length) {
configError = ARTLESS_ERR_UNIQUE
valid = false
} else if (v.some(el => isNaN(el.val))) {
configError = ARTLESS_ERR_SOME_NAN
valid = false
} else if (v.some(el => el.val > ma.val)) {
configError = ARTLESS_ERR_SOME_OVER
valid = false
}
return valid
}
},
lineWidth: { value: 3 },
bgcolorFromTheme: { value: true },
diffCenter: { value: '', required: false }
},
inputs: 1,
outputs: 0,
icon: 'artlessgauge.png',
paletteLabel: 'artless-gauge',
label: function () {
return this.name || 'artless-gauge';
},
oneditprepare: function () {
var typedefinitions = {
min: {
value: "min",
label: "Min ",
validate: RED.validators.number()
},
max: {
value: "max",
label: "Max ",
validate: RED.validators.number()
},
sec: {
value: "sec",
label: "Sec ",
validate: RED.validators.number()
},
}
function getTypeDef(type) {
return typedefinitions[type]
}
function getColor(idx) {
var colors = ['#009933', '#999999', '#ff6666', '#009999', '#cccc00', '#ff33cc', '#cc6600',
'#99ff66', '#660033'
]
if (idx > colors.length - 1) {
return colors[Math.floor(Math.random() * colors.length)]
}
return colors[idx]
}
function defaultRule(idx) {
return {
val: 5,
col: getColor(idx),
t: "sec"
}
}
function ruleInfo(error) {
$('#error-ruleinfo').text(error);
$('.red-ui-editableList-border').toggleClass('input-error', (error != ""));
}
function checkLineOptions() {
var opts = [3,5,7]
if($('#node-input-layout').val() == 'radial'){
var m = Math.min($('#node-input-width').val(),$('#node-input-height').val())
if(m > 3){
opts = [3,5,7,9,11,13,15]
}
}
else{
if($('#node-input-height').val() == 2){
opts = [3,5,7,9,11,13,15,17,19,21,23,25]
}
}
var last = $('#node-input-lineWidth').val()
if(last == null){
last = this.lineWidth || 3
}
$('#node-input-lineWidth').children().remove();
$.each(opts, function(key,value) {
$('#node-input-lineWidth')
.append($("<option></option>")
.attr("value",value)
.text(value+"px"));
});
if ($("#node-input-lineWidth option[value="+last+"]").length > 0 ){
$("#node-input-lineWidth").children("[value="+last+"]").attr('selected', true);
this.lineWidth = last;
}
else{
$("#node-input-lineWidth").children("[value=3]").attr('selected', true);
this.lineWidth = 3;
}
}
$('#node-input-size').elementSizer({
width: '#node-input-width',
height: '#node-input-height',
group: '#node-input-group'
});
if (this.layout === undefined) {
this.layout = 'linear';
$('#node-input-layout').val('Linear');
}
if (this.style === undefined) {
this.style = '';
$('#node-input-style').val('');
}
if (this.inline === undefined) {
this.inline = false;
$("#node-input-inline").prop('checked', false);
}
if (this.animate === undefined) {
this.animate = true;
$("#node-input-animate").prop('checked', true);
}
if (this.property === undefined) {
$("#node-input-property").val("payload");
}
if (this.secondary === undefined) {
$("#node-input-secondary").val("secondary");
}
$("#node-input-property").typedInput({ default: 'msg', types: ['msg'] });
$("#node-input-secondary").typedInput({ default: 'msg', types: ['msg'] });
if (this.differential === undefined) {
$("#node-input-differential").prop('checked', false);
}
$('#node-input-layout').change(function(){
if($('#node-input-layout option:selected').text() == 'Linear'){
$('#secondary-container').hide();
}else {
if($('#node-input-inline').is(":checked")){
$('#secondary-container').show();
}
}
})
$('#node-input-inline').change(function () {
if (this.checked == false) {
$('#secondary-container').hide();
} else {
if($('#node-input-layout option:selected').text() != 'Linear'){
$('#secondary-container').show();
}
}
});
$('#node-input-differential').change(function () {
if (this.checked == false) {
$('#node-input-diffCenter').hide();
$('#node-input-diffCenterSpan').hide();
} else {
$('#node-input-diffCenter').show();
$('#node-input-diffCenterSpan').show();
}
});
if (this.diffCenter === undefined) {
this.diffCenter = '';
$('#node-input-diffCenter').val('');
}
if (this.minmax === undefined) {
$("#node-input-minmax").prop('checked', false);
}
if (this.lineWidth === undefined) {
this.lineWidth = 3;
$('#node-input-lineWidth').val('3px');
}
$('#node-input-colorFromTheme').change(function () {
if (this.checked == true) {
$('#node-input-colorLine').hide();
$('#node-input-colorLineSpan').hide();
} else {
$('#node-input-colorLine').show();
$('#node-input-colorLineSpan').show();
}
});
$('#node-input-bgcolorFromTheme').change(function () {
if (this.checked == true) {
$('#node-input-colorTrack').hide();
$('#node-input-colorTrackSpan').hide();
} else {
$('#node-input-colorTrack').show();
$('#node-input-colorTrackSpan').show();
}
});
$("#node-input-rule-container").editableList({
removable: true,
sortable: true,
header: $("<div>").css({
padding: "6px"
}).append($.parseHTML(`
<div style='width:140px; text-align:center; display: inline-grid'><b>Value</b></div>
<div style='width:90px; text-align:center; display: inline-grid'><b>Color</b></div>
<div style='width:60px; text-align:center; display: inline-grid'><b>Dot</b></div>
<div id='error-ruleinfo' style='width:auto; color:red; text-align:center; font-weight:bold; display:inline-grid'></div>
`)),
addItem: function (container, index, rule) {
if (!rule.hasOwnProperty('t')) {
rule = defaultRule(index)
}
container.css({
overflow: 'hidden',
whiteSpace: 'nowrap'
});
var row = $('<div/>').appendTo(container);
var valField
var colorField
var dotField
var dotSuffix
valField = $('<input/>', {
class: "node-input-rule-value",
style: "width:120px;",
type: "text"
})
.appendTo(row)
.typedInput({
types: [getTypeDef(rule.t)]
});
colorField = $('<input/>', {
value: rule.col,
disabled: (rule.t == 'max'),
class: "node-input-rule-color",
style: "width:80px; margin-left:8px;",
type: "color"
})
.appendTo(row)
dotField = $('<input/>', {
value: rule.dot || 0,
class: "node-input-rule-dot",
style: "width:60px; margin-left:8px;",
type: "number",
min: '0',
max: '12',
size: '1'
})
.appendTo(row)
$("<div style='width:20px; text-align:center; display: inline-grid'>px</div>").appendTo(row);
valField.typedInput('type', getTypeDef(rule.t));
valField.typedInput('value', rule.val);
sortList()
colorField.on('change', function (type, value) {
if (configError != '') {
configError = ""
ruleInfo(configError)
}
sortList()
});
valField.typedInput().on('change', function (type, value) {
if (configError != '') {
configError = ""
ruleInfo(configError)
}
sortList()
});
},
removeItem: function (data) {
if (data.t == 'min' || data.t == 'max') {
$("#node-input-rule-container").editableList('addItem', data);
}
configError = ""
ruleInfo(configError)
sortList()
},
sort: function (dataA, dataB) {
return dataA.val - dataB.val;
}
});
function setColorForMax() {
var list = $("#node-input-rule-container").editableList('items');
var sum = Number.MIN_SAFE_INTEGER
var col = ''
var rule, t, v, c
list.each(function (i) {
rule = $(this);
t = rule.find(".node-input-rule-value").typedInput('type')
if (t == 'min' || t == 'sec') {
v = parseFloat(rule.find(".node-input-rule-value").typedInput('value'))
c = rule.find(".node-input-rule-color").val();
if (sum < v) {
sum = v
col = c
}
}
});
if (col != '') {
list.each(function (i) {
rule = $(this);
t = rule.find(".node-input-rule-value").typedInput('type')
if (t == 'max') {
rule.find(".node-input-rule-color").val(col)
}
});
}
}
function sortList() {
$("#node-input-rule-container").editableList('sort');
setColorForMax()
}
if (!this.sectors) {
var min = {
val: 0,
col: '#ff9900',
t: "min",
dot: 0
};
var max = {
val: 10,
col: '#ff9900',
t: "max",
dot: 0
};
this.sectors = [min, max];
}
function revalidate(v) {
configError = ""
var unique = [...new Set(v.map(s => s.val))]
var mi = v.find(el => el.t == 'min')
var ma = v.find(el => el.t == 'max')
if (mi.val > ma.val) {
configError = ARTLESS_ERR_MINMAX
} else if (v.length != unique.length) {
configError = ARTLESS_ERR_UNIQUE
} else if (v.some(el => isNaN(el.val))) {
configError = ARTLESS_ERR_SOME_NAN
} else if (v.some(el => el.val > ma.val)) {
configError = ARTLESS_ERR_SOME_OVER
}
}
revalidate(this.sectors)
$("#node-input-rule-container").editableList('addItems', this.sectors);
ruleInfo(configError)
$('#node-input-layout').change(function(){
window.setTimeout(checkLineOptions,20)
})
$('#node-input-width').change(function(){
window.setTimeout(checkLineOptions,30)
})
$('#node-input-height').change(function(){
window.setTimeout(checkLineOptions,40)
})
$("#node-input-decimals").spinner({
min:0,
max:8,
})
},
oneditsave: function () {
var list = $("#node-input-rule-container").editableList('items');
var node = this;
node.sectors = [];
var convert = function (rule) {
rule.val = parseFloat(rule.val)
rule.dot = parseInt(rule.dot)
return rule
}
list.each(function (i) {
var rule = $(this);
var t = rule.find(".node-input-rule-value").typedInput('type')
var v = rule.find(".node-input-rule-value").typedInput('value')
var c = rule.find(".node-input-rule-color").val();
var d = rule.find(".node-input-rule-dot").val()
var r = convert({
val: v,
col: c,
t: t,
dot: d
})
node.sectors.push(r);
});
}
});
</script>
<script type='text/x-red' data-template-name='ui_artlessgauge'>
<div class='form-row' id='template-row-group'>
<label for='node-input-group'><i class='fa fa-table'></i> Group</span></label>
<input type='text' id='node-input-group'>
</div>
<div class='form-row' id='template-row-size'>
<label><i class='fa fa-object-group'></i> Size</span></label>
<input type='hidden' id='node-input-width'>
<input type='hidden' id='node-input-height'>
<button class='editor-button' id='node-input-size'></button>
</div>
<div class="form-row">
<label for="node-input-property"><i class="fa fa-arrow-right"></i> Input</label>
<input type="text" id="node-input-property" style="width:70%;"/>
</div>
</br>
<div class='form-row' id='node-input-el-label'>
<label for='node-input-label'><i class='icon-tag'></i> Label</label>
<input type='text' id='node-input-label' placeholder='Gauge'>
</div>
<div class='form-row' id='node-input-el-icon'>
<label for='node-input-icon'><i class='icon-tag'></i> Icon</label>
<input type='text' id='node-input-icon' placeholder='fa-fire'>
</div>
<div class='form-row'>
<label for='node-input-layout'><i class='fa fa-list'></i> Layout</label>
<select id='node-input-layout' style='width:200px !important'>
<option value='linear'>Linear</option>
<option value='radial'>Radial</option>
</select>
</div>
<div class='form-row' id='node-input-diffmode'>
<label for='node-input-differential'><i class='fa fa-gear'></i> Mode</span></label>
<input type="checkbox" id="node-input-differential" style="display:inline-block; width:auto; vertical-align:baseline; margin-right:5px;">differential
<span for='node-input-diffCenter' id='node-input-diffCenterSpan' style='margin-left:20px;'>center</span>
<input type='text' id='node-input-diffCenter' style='width:80px' placeholder='' dir=''>
</div>
<div class='form-row'>
<label><i class='fa fa-gear'></i> Range</label>
</div>
<div class="form-row node-input-rule-container-row">
<ol id="node-input-rule-container"></ol>
</div>
</br>
<div class='form-row'>
<label for='node-input-animate'><i class='fa fa-gear'></i> Animate</label>
<input type="checkbox" id="node-input-animate" checked style="display:inline-block; width:auto; vertical-align:baseline; margin-right:5px;"></input>
</div>
<div class='form-row'>
<label for='node-input-lineWidth'><i class='fa fa-list'></i> Line width</label>
<select id='node-input-lineWidth' style='width:70px !important'>
<option value=3>3px</option>
<option value=5>5px</option>
<option value=7>7px</option>
<option value=9>9px</option>
<option value=11>11px</option>
<option value=13>13px</option>
<option value=15>15px</option>
<option value=17>17px</option>
<option value=19>19px</option>
<option value=21>21px</option>
<option value=23>23px</option>
<option value=25>25px</option>
</select>
</div>
<div class='form-row'>
<label for='node-input-style'><i class='fa fa-paint-brush'></i> Line style</label>
<input type='text' id='node-input-style' style='width:120px' placeholder='2, 2' dir=''>
</div>
<div class='form-row' id='node-input-linebgcolor'>
<label for='node-input-bgcolorFromTheme' style='padding-top:6px; padding-bottom:6px'><i class='fa fa-paint-brush'></i> Track color</span></label>
<input type="checkbox" id="node-input-bgcolorFromTheme" checked style="display:inline-block; width:auto; vertical-align:baseline; margin-right:5px;">Use theme color
<span for='node-input-colorTrack' id='node-input-colorTrackSpan' style='margin-left:20px;'>Custom color</span>
<input type='color' id='node-input-colorTrack' style='width:80px'/>
</div>
<div class='form-row' id='node-input-minmaxshow'>
<label for='node-input-minmax'><i class='fa fa-gear'></i> Tickmarks</span></label>
<input type="checkbox" id="node-input-minmax" style="display:inline-block; width:auto; vertical-align:baseline; margin-right:5px;">Show for min and max (and center)
</div>
<div class='form-row'>
<label for='node-input-decimals'><i class='fa fa-gear'></i> Round value</label>
<input type='text' id='node-input-decimals' style='width:50px ;border:none' placeholder='0'>
<span for='node-input-decimals'> decimals</span>
</div>
<div class='form-row'>
<label for='node-input-unit'><i class='fa fa-gear'></i> Unit</label>
<input type='text' id='node-input-unit' style='width:120px' placeholder='units' dir=''>
<input type="checkbox" id="node-input-inline" style="display:inline-block; width:auto; vertical-align:baseline; margin-right:5px;"></input>
<label id="node-input-inline-label" for='node-input-inline'> Inline with value</label>
</div>
<div class="form-row" id="secondary-container">
<label for="node-input-secondary" style="font-size:11px;"><i class="fa fa-arrow-right"></i> Secondary input</label>
<input type="text" id="node-input-secondary" style="width:70%;"/>
</div>
</br>
<div class='form-row'>
<label for='node-input-name'><i class='icon-tag'></i> Name</label>
<input type='text' id='node-input-name' placeholder='Name'>
</div>
</script>
<script type='text/x-red' data-help-name='ui_artlessgauge'>
<p>Artless gauge is gauge with minimal design. Gauge has two layouts - linear and radial.
Both layouts support regular mode and differential mode.
With differential mode, the indicating colored track is drawn from center to side.
<h2>> Configuration</h2>
<h3> Size</h3>
For linear layout the supported height is 1 unit.
For radial mode the minimal size is 2x2 units.
Supported size configuration for radial layout is square (3x3, 4x4, ...).
Widget forces different size combinations to be square based on shortest side.
<h2> Input </h2>
Configured input property (default is msg.payload) should carry single numeric value.
<h3> Label</h3>
Label can be any string. Label field does not support any html for color or size adjustments.
<h3> Icon</h3>
Supported icons are same as for dashboard:
<a href="https://fontawesome.com/v4.7.0/icons/">Font Awesome 4.7</a>,
<a href="https://material.io/resources/icons/?style=baseline">Material Icons</a> and
<a href="https://github.com/Paul-Reed/weather-icons-lite">Weather icons lite</a>.
<p>If your setup has internet connection, you can also use <a href="https://iconify.design/">Iconify icons</a>.
To use Iconify icons, use prefix <code>iconify-</code> and you'll need to add the iconify API to the dashboard site head.
<p>Any type of icon accepts additional classes. For example you can animate <code>iconify-mdi:fan</code> by adding <code>fa-spin</code>.
<h3> Layout</h3>
Choose layout type. Layout can be linear or radial.
<h3> Mode</h3>
Option to turn on differential mode. With this option selected, the colored track has
center point from which the value is shown.Value of center point can be adjusted.
If center value is not defined, the center point is exactly between configured min and max.
<h3> Range</h3>
Configure minimum and maximum expected values and adjust line color.
Add segments and configure colors for them if needed.
Note that Min and Max options can not be removed.
<p>A small dot with segment color can be drawn at the point of segment.
To show dot for segment, configure size for dot bigger that zero.
<h3>Animate</h3>
You can turn on or off the animations of the colored bar.
<h3>Line width</h3>
You can adjust thickness of the colored bar. The range of possible values depends on layout and configured size.
<h3>Line style</h3>
You can make the colored bar to be dashed line. Provided comma separated list of numbers makes pattern of dash-array.
First number represents dash width, second number represents gap width.
<p>
<code>
2, 2
</code>
<p>In addition there is option to make dash ends to be round by adding the word "round" to the end of list.
To get perfetly round dots, configure dash width to 0 and gap width equal or a bit larger than Line width.
<p>
<code>
0, 8, round
</code>
<p>See more about <a href="https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-dasharray">stroke dash-array</a>
<h3> Track color</h3>
Color of track background line can be configured. By default, the site colors used.
<h3> Tickmarks</h3>
Min and max values can be shown near the track.
For differential mode, also the center value is shown.
<p>With radial layout the tickmarks can be shown only if layout size is 3x3 units or more.
<h3>Round value</h3>
Value is always rounded according to the configured decimals.
Default is zero so value presented as integer.
<h3>Unit</h3>
Unit is displayed near the value field. Unit can be any string.
For radial layout by default the unit is shown below the value field.
The unit can be shown inline with the value. By using this option, there
will be secondary value field available to show any string below the main value field.
<h3>Secondary input</h3>
Secondary input is available only for radial layout and if uint is placed inline with value field.
Value for configured secondary input property
(default is msg.secondary) should be string or number.
<h2> Change the configuration at runtime</h2>
Many options of widget configuration can be overrided at runtime using the <code>msg.control</code> property.
You can send options one by one, or all together. Note, that min and max must be part of sectors property.
Change of min or max will not affect sectors if they were configured.
But any sector update clears all previously configured sectors except the min and max.
There is no validation on top of incoming sectors configuration.
<h3>Configurable options and value types</h3>
<code>
sectors - Array of Object´s<br>
unit - String<br>
label - String<br>
icon - String<br>
center - Number<br>
decimals - Number<br>
</code>
<h3>Example</h3>
<code style="white-space:unset" >
var newSectors = [{t:"min",val:5,col:"#00ff00",dot:3},{t:"sec",val:8,col:"#ff0000",dot:3},{t:"max",val:30,col:"#0000ff",dot:3}]
msg.control = {unit:"degrees",label:"Temperature",icon:"fa-thermometer",center:4, decimals:1, sectors:newSectors}
</code>
<h2> Licence</h2>
This node uses GreenSock animation library GSAP licenced with Standard GreenSock License for non-commercial use <a href="https://greensock.com/standard-license/"">https://greensock.com/standard-license</a>
</script>