Added export popup (only UI)

This commit is contained in:
l_samenv
2024-08-23 15:29:14 +02:00
parent 9e012ac740
commit 07946fc851
7 changed files with 360 additions and 0 deletions

View File

@ -261,7 +261,10 @@ let globalIndicators = (function (){
function loadGraphicsMenu(panel){
let menuGraphicsPopup = new MenuPopup();
let exportActionEntry = new ActionEntry("Export", graphs.displayExportPopup);
let removeCursorHelpEntry = new HelpEntry("How to remove the cursor", "You can double click/tap on any graph.");
menuGraphicsPopup.addEntry(exportActionEntry)
menuGraphicsPopup.addHorizontalDivider();
menuGraphicsPopup.addEntry(removeCursorHelpEntry);
let graphicsMenuControl = new Control("res/menu_white.png", "res/menu_white.png", "Menu", () => {menuGraphicsPopup.show()});
@ -273,6 +276,18 @@ function loadGraphicsMenu(panel){
graphicsMenuControl.style.marginRight="6px";
}
let exportPopup = undefined;
function loadExportPopup(){
let graphsContainer = document.getElementsByClassName("graphs-container")[0];
exportPopup = new ExportPopup(exportCallback);
graphsContainer.appendChild(exportPopup);
}
function exportCallback(selectedVariables, startDateTimeMs, endDateTimeMs, binning=null){
console.log(selectedVariables, startDateTimeMs, endDateTimeMs, binning);
}
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=[];
@ -891,6 +906,7 @@ let graphs = (function (){
currentSwiper.slideNext();
});
loadExportPopup();
globalIndicators.loadIndicators(graphicsPanel);
globalControls.loadControls(graphicsPanel);
loadGraphicsMenu(graphicsPanel);
@ -1145,6 +1161,10 @@ let graphs = (function (){
}
}
function displayExportPopup(){
exportPopup.show(blocks,currentMinTime, currentMaxTime);
}
/**
* 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
@ -1188,6 +1208,8 @@ let graphs = (function (){
jumpToDate: jumpToDate,
initGraphs: initGraphs,
onZoomCompleteCallback:onZoomCompleteCallback,
displayExportPopup:displayExportPopup
}
})();