+
@@ -428,7 +428,7 @@
menu
-
+
@@ -510,29 +510,33 @@
let isResizing = false;
let lastDownY = 0;
+ let savedHeight = localStorage.getItem('chart_height');
if (resizer && chartWrapper) {
- resizer.addEventListener('mousedown', (e) => {
- isResizing = true;
- lastDownY = e.clientY;
- document.body.style.cursor = 'row-resize';
- chartWrapper.style.pointerEvents = 'none'; // Prevent iframe/canvas capturing mouse
- });
+ if (savedHeight) {
+ chartWrapper.style.flex = 'none';
+ chartWrapper.style.height = savedHeight + 'px';
+ }
- document.addEventListener('mousemove', (e) => {
+ const startResize = (y) => {
+ isResizing = true;
+ lastDownY = y;
+ document.body.style.cursor = 'row-resize';
+ chartWrapper.style.pointerEvents = 'none';
+ };
+
+ const doResize = (y) => {
if (!isResizing) return;
- const deltaY = e.clientY - lastDownY;
- lastDownY = e.clientY;
+ const deltaY = y - lastDownY;
+ lastDownY = y;
const newHeight = chartWrapper.offsetHeight + deltaY;
- // Min 200px, Max windowHeight - 150px
if (newHeight > 200 && newHeight < window.innerHeight - 150) {
chartWrapper.style.flex = 'none';
chartWrapper.style.height = newHeight + 'px';
- // Force chart layout recalculation if applicable
if (window.dashboard && window.dashboard.chart) {
const container = document.getElementById('chart');
window.dashboard.chart.applyOptions({
@@ -541,15 +545,27 @@
});
}
}
- });
+ };
- document.addEventListener('mouseup', () => {
+ const endResize = () => {
if (isResizing) {
isResizing = false;
document.body.style.cursor = '';
chartWrapper.style.pointerEvents = 'auto';
+ const currentHeight = chartWrapper.style.height;
+ localStorage.setItem('chart_height', currentHeight ? parseFloat(currentHeight) : 75);
}
- });
+ };
+
+ resizer.addEventListener('mousedown', (e) => startResize(e.clientY));
+ resizer.addEventListener('touchstart', (e) => startResize(e.touches[0].clientY), {passive: false});
+
+ document.addEventListener('mousemove', (e) => doResize(e.clientY));
+ document.addEventListener('touchmove', (e) => doResize(e.touches[0].clientY), {passive: false});
+
+ document.addEventListener('mouseup', endResize);
+ document.addEventListener('touchend', endResize);
+ document.addEventListener('touchcancel', endResize);
}
});