Running curves settings
This commit is contained in:
@ -323,14 +323,10 @@ let curvesSettingsPopup = undefined;
|
||||
|
||||
function loadCurvesSettingsPopup(){
|
||||
let graphsContainer = document.getElementsByClassName("graphs-container")[0];
|
||||
curvesSettingsPopup = new CurvesSettingsPopup(applySettingsCallback);
|
||||
curvesSettingsPopup = new CurvesSettingsPopup(graphs.applySettingsCallback);
|
||||
graphsContainer.appendChild(curvesSettingsPopup);
|
||||
}
|
||||
|
||||
function applySettingsCallback(userConfiguration){
|
||||
console.log(JSON.stringify(userConfiguration));
|
||||
}
|
||||
|
||||
let graphs = (function (){
|
||||
let dataset_to_graph_map = {}; // a dictionnary mapping a variable name to a two values array, containing its graph index and its position inside the graph
|
||||
let blocks, liveMode=true, top_vars=[], bottom_vars=[];
|
||||
@ -1213,6 +1209,24 @@ let graphs = (function (){
|
||||
exportPopup.show(blocks,currentMinTime, currentMaxTime);
|
||||
}
|
||||
|
||||
function applySettingsCallback(userConfiguration){
|
||||
cursorLine(null);
|
||||
|
||||
AJAX("http://" + hostPort + "/getvars?time=" + currentMinTime/1000 + "," + currentMaxTime/1000 + "&userconfiguration=" + JSON.stringify(userConfiguration) + "&id="+ clientID).getJSON().then(function(data){
|
||||
blocks = data.blocks;
|
||||
document.getElementById("device").innerHTML = data.device
|
||||
maxTime = currentMaxTime;
|
||||
minTime = currentMinTime;
|
||||
|
||||
globalIndicators.getIndicatorsMap()[datesKey].update(currentMinTime);
|
||||
|
||||
ngraphs = 0; // forces all the graphs to reset
|
||||
createGraphs();
|
||||
|
||||
if (liveMode && currentMaxTime < lastTime) setLiveMode(false);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Make sure that the updatAuto() function called in chartJS' onZoomComplete callback is delayed
|
||||
* This is needed for mobile phones, as this callback is triggered too often
|
||||
@ -1257,7 +1271,8 @@ let graphs = (function (){
|
||||
initGraphs: initGraphs,
|
||||
onZoomCompleteCallback:onZoomCompleteCallback,
|
||||
|
||||
displayExportPopup:displayExportPopup
|
||||
displayExportPopup:displayExportPopup,
|
||||
applySettingsCallback:applySettingsCallback
|
||||
}
|
||||
})();
|
||||
|
||||
|
Reference in New Issue
Block a user