Skip to content

Commit 3a5d6b9

Browse files
committed
Fix this progress bar
1 parent d20f052 commit 3a5d6b9

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

go-rewrite/static/js/app.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2567,14 +2567,24 @@ function createCombinedGauges() {
25672567
startBar.style.height = '100%';
25682568
startBar.style.backgroundColor = '#FFB74D'; // Orange for start
25692569

2570+
// Create a difference bar to show the charging progress with a different color
2571+
const diffBar = document.createElement('div');
2572+
diffBar.style.position = 'absolute';
2573+
diffBar.style.left = `${currentSession.soc_start}%`;
2574+
diffBar.style.top = '0';
2575+
diffBar.style.width = `${currentSession.soc_end - currentSession.soc_start}%`;
2576+
diffBar.style.height = '100%';
2577+
diffBar.style.backgroundColor = '#3498db'; // Blue for the difference
2578+
diffBar.style.transition = 'width 1s ease-in-out';
2579+
2580+
// Keep the end bar for reference but make it transparent
25702581
const endBar = document.createElement('div');
25712582
endBar.style.position = 'absolute';
25722583
endBar.style.left = '0';
25732584
endBar.style.top = '0';
2574-
endBar.style.width = `${currentSession.soc_end}%`;
2585+
endBar.style.width = '0'; // No width needed as we're showing the difference separately
25752586
endBar.style.height = '100%';
2576-
endBar.style.backgroundColor = '#4CAF50'; // Green for end
2577-
endBar.style.transition = 'width 1s ease-in-out';
2587+
endBar.style.backgroundColor = 'transparent'; // Make it transparent
25782588

25792589
// Add values on the progress bar
25802590
const startValue = document.createElement('span');
@@ -2599,6 +2609,7 @@ function createCombinedGauges() {
25992609

26002610
// Assemble SOC progress bar
26012611
socBarContainer.appendChild(startBar);
2612+
socBarContainer.appendChild(diffBar); // Add the difference bar
26022613
socBarContainer.appendChild(endBar);
26032614
socBarContainer.appendChild(startValue);
26042615
socBarContainer.appendChild(endValue);

0 commit comments

Comments
 (0)