Removed created + some unused functions and comments (Graphics JS file)

This commit is contained in:
l_samenv
2024-08-16 13:39:20 +02:00
parent 7fa880d67d
commit 474a855fad
2 changed files with 15 additions and 114 deletions

View File

@ -290,7 +290,6 @@ let graphs = (function (){
let resolution = undefined;
let created = false;
let activateUpdateTimeout = undefined;
let updateAutoTimeout = undefined;
@ -380,8 +379,6 @@ let graphs = (function (){
}
}
let gotoNowElm = document.createElement('div');
/**
* Sets live mode and enable/disable 'go to now' button
* @param {boolean} mode - Tells if we are in live mode or not
@ -461,22 +458,6 @@ let graphs = (function (){
activateUpdateTimeout = setTimeout(function(){
activateUpdates();
}, 1000);
// Was here before
// result = AJAX( "http://" + hostPort +
// "/updategraph?variables=" + variables() +
// "&id=" + clientID).getJSON().then(function(data) {
// setLiveMode(data.live);
// console.log('LIVE create', liveMode)
// })
// result = AJAX( "http://" + hostPort +
// "/updategraph?" +
// "id=" + clientID).getJSON().then(function(data) {
// setLiveMode(data.live);
// console.log('LIVE create', liveMode)
// })
// //console.log('UPDATE LIVE', result);
})
}
@ -598,8 +579,7 @@ let graphs = (function (){
legendFlag = true;
let trect = evt.target.getBoundingClientRect();
let X = evt.clientX - trect.x, Y = evt.clientY - trect.y;
displayAllLegends();
// showLegends(true, false);
showLegends(true, false);
cursorLine(X);
setLiveMode();
update();
@ -673,17 +653,8 @@ let graphs = (function (){
}
console.log("RELOAD")
activateUpdates();
// Was here before
// AJAX( "http://" + hostPort + "/updategraph?id=" + clientID).getJSON(); // activate updates
// result = AJAX("http://" + hostPort +
// "/updategraph?variables=" + variables() +
// "&id=" + clientID).getJSON().then(function(data) {
// setLiveMode(data.live);
// console.log('LIVE reload', liveMode)
// })
updateAuto(false);
//update();
});
}
@ -726,36 +697,6 @@ let graphs = (function (){
}
}
function zoomIn(){
console.log("Zoomed in !");
let someGraph = graph_array[0];
let xTk = someGraph.chart.options.scales.xAxes[0].ticks;
let pZoom = 0.2; //window width for the zoom (a proportion of the current window, centered)
let delta = (xTk.max - xTk.min)*pZoom/2;
xTk.max -= delta;
xTk.min += delta;
if (liveMode && xTk.max < lastTime) setLiveMode(false);
setMinMax(xTk.min, xTk.max);
updateAuto();
}
function zoomOut(){
console.log("Zoomed out !");
let someGraph = graph_array[0];
let xTk = someGraph.chart.options.scales.xAxes[0].ticks;
let pZoom = 0.2; //window width for the zoom (a proportion of the current window, centered)
let delta = (xTk.max - xTk.min)*pZoom/2;
xTk.max += delta;
xTk.min -= delta;
if (liveMode && xTk.max < lastTime) setLiveMode(false);
setMinMax(xTk.min, xTk.max);
updateAuto();
}
/**
* Function called at each mouse wheel step.
* If zoom mode in x mode, disables liveMode if the visualisaiton window is older than the last known value and sets axis min and max
@ -860,32 +801,6 @@ let graphs = (function (){
}
}
function shiftOlder(){
let someGraph = graph_array[0];
let xTk = someGraph.chart.options.scales.xAxes[0].ticks;
let pShift = 0.2; //shift size the pan (a proportion of the current window)
let delta = (xTk.max - xTk.min)*pShift;
xTk.max -= delta;
xTk.min -= delta;
if (liveMode && xTk.max < lastTime) setLiveMode(false);
setMinMax(xTk.min,xTk.max);
updateAuto();
}
function shiftNewer(){
let someGraph = graph_array[0];
let xTk = someGraph.chart.options.scales.xAxes[0].ticks;
let pShift = 0.2; //shift size the pan (a proportion of the current window)
let delta = (xTk.max - xTk.min)*pShift;
xTk.max += delta;
xTk.min += delta;
if (liveMode && xTk.max < lastTime) setLiveMode(false);
setMinMax(xTk.min,xTk.max);
updateAuto();
}
/**
* The function called when the viewing window is moved by the mouse.
*
@ -1004,7 +919,6 @@ let graphs = (function (){
gotoMainElm.style.marginRight = "6px";
gotoMainElm.style.color = "white";
gotoMainElm.style.cursor = "pointer";
created = true;
if (isTouchDevice) {
doubleTap(removeCursor);
@ -1016,10 +930,7 @@ let graphs = (function (){
}
function initGraphs(blocks){
if(!created){
buildGraphicsUI();
created = true;
}
buildGraphicsUI();
receivedVars(blocks);
}
@ -1112,14 +1023,6 @@ let graphs = (function (){
//bringToFront(null);
}
function displayAllLegends(){
showLegends(true, false);
}
function hideAllLegends(){
showLegends(false, false);
}
/**
* Adjust the legend window depending on the position of the last legend
*/
@ -1274,7 +1177,6 @@ let graphs = (function (){
return {
addDataset: addDataset,
//toggleAxesType: toggleAxesType,
newDataHandler: newDataHandler,
zoomCallback: zoomCallback,
panCallback: panCallback,
@ -1293,16 +1195,9 @@ let graphs = (function (){
setLiveMode: setLiveMode,
cursorLine: cursorLine,
bringToFront: bringToFront,
// Exposing callbacks for controls and indicators
gotoNow: gotoNow,
displayAllLegends: displayAllLegends,
hideAllLegends: hideAllLegends,
toggleZoomMode: toggleZoomMode,
removeCursor: removeCursor,
zoomOut: zoomOut,
zoomIn: zoomIn,
shiftOlder: shiftOlder,
shiftNewer: shiftNewer,
jumpToDate: jumpToDate,
initGraphs: initGraphs,
onZoomCompleteCallback:onZoomCompleteCallback,

View File

@ -1,10 +1,16 @@
# device.parameter=cat[,color[,unit]]
# device.parameter=cat:raw,color:yellow
[nicos]
se_t_plato.raw=raw,#FFF,Ohm
[chart]
t_plato.raw=raw,#FFF,Ohm
se_t_plato.target=none # do not show
se_t_plato.raw=std # show in standard section
se_t_plato.raw=raw # show in extra section "raw"
se_t_plato.value=std,unit:Ohm # custom unit
T_plato.target=none # do not show
T_plato.raw=rawOhm # show in extra section "rawOhm"
T_plato=,,Ohm # custom unit
T_plato=unit:Ohm # custom unit
tag -> cat
lookup with the label (secop module)