Skip to content

Colors theme: fix graph for old data without prices - #4355

Closed
cshagen wants to merge 1 commit into
openWB:masterfrom
cshagen:update-web-2611
Closed

cshagen wants to merge 1 commit into
openWB:masterfrom
cshagen:update-web-2611

Conversation

@cshagen

@cshagen cshagen commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

Summary by Sourcery

Handle historical power graph data without prices safely.

Bug Fixes:

  • Prevent the Colors power graph from failing when historical data has no price information and default missing or non-positive grid prices to zero.

Enhancements:

  • Make price data optional for historical graph records.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="packages/modules/web_themes/colors/source/src/components/powerGraph/processDayGraphData.ts" line_range="193" />
<code_context>
 		currentItem.price = currentRow.prices.grid * 100000
+	} else {
+		currentItem.price = 0
 	}

 	// Self Usage
</code_context>
<issue_to_address>
**Missing prices distort price display**

When historical rows lack price data and the price line or tooltip is displayed, `transformRow` sets `price` to zero, so `PriceLine` draws a zero-price line and the tooltip formats unavailable prices as real currency; on days that also contain positive prices, `PriceLine.yScale` falls back to a `[0, 0]` domain and plots the line flat.

Represent missing prices as unavailable rather than zero so the line, tooltip, and scale do not treat them as real prices.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨

currentItem.price = currentRow.prices.grid * 100000
} else {
currentItem.price = 0
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium · Missing prices distort price display

When historical rows lack price data and the price line or tooltip is displayed, transformRow sets price to zero, so PriceLine draws a zero-price line and the tooltip formats unavailable prices as real currency; on days that also contain positive prices, PriceLine.yScale falls back to a [0, 0] domain and plots the line flat.

Represent missing prices as unavailable rather than zero so the line, tooltip, and scale do not treat them as real prices.

Prompt for AI agents
In `packages/modules/web_themes/colors/source/src/components/powerGraph/processDayGraphData.ts` at line 193:

**Missing prices distort price display**

When historical rows lack price data and the price line or tooltip is displayed, `transformRow` sets `price` to zero, so `PriceLine` draws a zero-price line and the tooltip formats unavailable prices as real currency; on days that also contain positive prices, `PriceLine.yScale` falls back to a `[0, 0]` domain and plots the line flat.

Represent missing prices as unavailable rather than zero so the line, tooltip, and scale do not treat them as real prices.

@cshagen cshagen closed this Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant