fix live updates

This commit is contained in:
Dobromir Popov
2025-12-10 14:39:06 +02:00
parent e200600a0a
commit 732c5b4941
6 changed files with 290 additions and 8 deletions

View File

@@ -773,9 +773,14 @@ class ChartManager {
const volumeColor = candle.close >= candle.open ? '#10b981' : '#ef4444';
Plotly.extendTraces(plotId, {
x: [[formattedTimestamp]],
y: [[candle.volume]],
marker: { color: [[volumeColor]] }
y: [[candle.volume]]
}, [1]).then(() => {
// Update volume color separately using restyle
const currentTrace = plotElement.data[1];
if (currentTrace && currentTrace.marker && currentTrace.marker.color) {
const newColors = [...currentTrace.marker.color, volumeColor];
Plotly.restyle(plotId, {'marker.color': [newColors]}, [1]);
}
console.log(`[${timeframe}] Volume trace extended successfully`);
}).catch(err => {
console.error(`[${timeframe}] Error extending volume trace:`, err);
@@ -4393,7 +4398,6 @@ class ChartManager {
this.liveMetricsOverlay = null;
}
}
// Debug method to manually trigger pivot recalculation
debugRecalculatePivots(timeframe) {
@@ -4424,4 +4428,5 @@ class ChartManager {
}
});
console.log('========================');
}
}
}