fix hide/show graph window
This commit is contained in:
@@ -41,7 +41,7 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div id="graph-container" class="hidden">
|
<div id="graph-container" class="hidden">
|
||||||
<button id="close-btn">X</button>
|
<button onclick="hideGraph()" id="close-btn">X</button>
|
||||||
<canvas id="myChart"></canvas>
|
<canvas id="myChart"></canvas>
|
||||||
</div>
|
</div>
|
||||||
<!--script type="module" src="./tempgraph.ts"></script-->
|
<!--script type="module" src="./tempgraph.ts"></script-->
|
||||||
|
|||||||
10
src/roast.ts
10
src/roast.ts
@@ -18,6 +18,7 @@ interface Window {
|
|||||||
logTemp?: Function; //function to log a temputure event
|
logTemp?: Function; //function to log a temputure event
|
||||||
exportCSV?: Function; //function to export the events to CSV
|
exportCSV?: Function; //function to export the events to CSV
|
||||||
showGraph?: Function; // function to render or display graphs using libraries like Chart.js for visual representation of logged events
|
showGraph?: Function; // function to render or display graphs using libraries like Chart.js for visual representation of logged events
|
||||||
|
hideGraph?: Function; //function to hind the graph popup
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -168,6 +169,14 @@ function showGraph(): void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function hideGraph(): void {
|
||||||
|
const graphContainer = document.getElementById("graph-container");
|
||||||
|
if (graphContainer) {
|
||||||
|
graphContainer.classList.add("hidden");
|
||||||
|
graphContainer.classList.remove("graph-display-flex");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Expose functions to the global scope (allowing html direct access)
|
// Expose functions to the global scope (allowing html direct access)
|
||||||
if (typeof window !== 'undefined') {
|
if (typeof window !== 'undefined') {
|
||||||
window.startTimer = startTimer;
|
window.startTimer = startTimer;
|
||||||
@@ -179,4 +188,5 @@ if (typeof window !== 'undefined') {
|
|||||||
window.logTemp = logTemp;
|
window.logTemp = logTemp;
|
||||||
window.exportCSV = exportCSV;
|
window.exportCSV = exportCSV;
|
||||||
window.showGraph = showGraph;
|
window.showGraph = showGraph;
|
||||||
|
window.hideGraph = hideGraph;
|
||||||
}
|
}
|
||||||
@@ -105,10 +105,3 @@ new Chart(ctx, {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
document.getElementById('close-btn')?.addEventListener('click', () => {
|
|
||||||
const container = document.getElementById('graph-container');
|
|
||||||
if (container) {
|
|
||||||
container.style.display = container.style.display === 'none' ? 'flex' : 'none';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
Reference in New Issue
Block a user