width gauge variabile + aggiornamento settings

This commit is contained in:
Marco Locatelli
2021-04-15 15:14:11 +02:00
parent 98af316c75
commit a059b1b599
2 changed files with 33 additions and 21 deletions
+30 -21
View File
@@ -17,16 +17,19 @@
function dataRefresh() {
// scarico i dati aggioranti
$.ajax({url: "/api/v1/channels/all", success: function(result){
var divWidth = document.getElementById("divChA").offsetWidth
// compilo i dati scaricati
$("#SelChannelA").html(result.ChA);
$("#OutputA").html(result.Outs[result.ChA]);
setGaugeA(result.Outs[result.ChA],result.Outmin[result.ChA],result.Outmax[result.ChA]);
setGaugeA(divWidth,result.Outs[result.ChA],result.Outmin[result.ChA],result.Outmax[result.ChA]);
$("#SelChannelB").html(result.ChB);
$("#OutputB").html(result.Outs[result.ChB]);
setGaugeB(result.Outs[result.ChB],result.Outmin[result.ChB],result.Outmax[result.ChB]);
setGaugeB(divWidth,result.Outs[result.ChB],result.Outmin[result.ChB],result.Outmax[result.ChB]);
$("#LogFrequency").html(result.LogFreq);
$("#WriteFrequency").html(result.WriteFreq);
@@ -75,6 +78,7 @@
$("#UniMisuA").html(result.UniMeasure[result.ChA]);
$("#UniMisuB").html(result.UniMeasure[result.ChB]);
}});
// A ogni giro di data refresh fix di tabella cartelle e tabella file
fixFolderTable();
fixFileTable();
@@ -82,38 +86,43 @@
timeout = setTimeout(dataRefresh, intTime);
};
function setGaugeA(chValA,outMinA,outMaxA){
function setGaugeA(divWidth,chValA,outMinA,outMaxA){
// Create knob elements
const knob0 = pureknob.createKnob(200, 200);
const knob0 = pureknob.createKnob(divWidth, divWidth);
// Set properties knob0
knob0.setProperty('angleStart', -0.8 * Math.PI);
knob0.setProperty('angleEnd', 0.8 * Math.PI);
knob0.setProperty('angleStart', -0.85 * Math.PI);
knob0.setProperty('angleEnd', 0.85 * Math.PI);
knob0.setProperty('colorFG', '#07adec');
knob0.setProperty('trackWidth', 0.3);
knob0.setProperty('valMin', parseInt(outMinA));
knob0.setProperty('valMax', parseInt(outMaxA));
knob0.setProperty('valMin', parseInt(outMinA)*1000);
knob0.setProperty('valMax', parseInt(outMaxA)*1000);
knob0.setProperty('readonly', 'true');
// nascondo numero
knob0.setProperty('textScale', '0');
knob0.resize();
// Set initial value0
knob0.setValue(chValA);
knob0.setValue(chValA*1000);
// Create element node0
const node0 = knob0.node();
// Add it to the DOM.
$("#divChA").html(node0);
}
function setGaugeB(chValB,outMinB,outMaxB){
function setGaugeB(divWidth,chValB,outMinB,outMaxB){
// Create knob elements
const knob1 = pureknob.createKnob(200, 200);
const knob1 = pureknob.createKnob(divWidth, divWidth);
// Set properties knob1
knob1.setProperty('angleStart', -0.8 * Math.PI);
knob1.setProperty('angleEnd', 0.8 * Math.PI);
knob1.setProperty('angleStart', -0.85 * Math.PI);
knob1.setProperty('angleEnd', 0.85 * Math.PI);
knob1.setProperty('colorFG', '#07adec');
knob1.setProperty('trackWidth', 0.3);
knob1.setProperty('valMin', parseInt(outMinB));
knob1.setProperty('valMax', parseInt(outMaxB));
knob1.setProperty('valMin', parseInt(outMinB)*1000);
knob1.setProperty('valMax', parseInt(outMaxB)*1000);
knob1.setProperty('readonly', 'true');
// Set initial value1
knob1.setValue(chValB);
// nascondo numero
knob1.setProperty('textScale', '0');
// Set valore
knob1.setValue(chValB*1000);
// Create element node1
const node1 = knob1.node();
// Add it to the DOM.
@@ -284,8 +293,8 @@
<div id="divChA"></div>
<div class="row">
<div class="col-12">
<span class="h5" id="OutputA"></span>
<span class="h5" id="UniMisuA"></span>
<span class="h3" id="OutputA"></span>
<span class="h3" id="UniMisuA"></span>
</div>
</div>
</div>
@@ -300,8 +309,8 @@
<div id="divChB"></div>
<div class="row">
<div class="col-12">
<span class="h5" id="OutputB"></span>
<span class="h5" id="UniMisuB"></span>
<span class="h3" id="OutputB"></span>
<span class="h3" id="UniMisuB"></span>
</div>
</div>
</div>
+3
View File
@@ -129,6 +129,9 @@
,url: "/api/v1/setup/selectChannel/" + ddlChannels.value
,data: ""
});
refreshInput();
refreshSettings();
dataRefresh();
};
</script>