Skip to content

Colors theme fix: non-existing prices in older graph data - #4356

Draft
cshagen wants to merge 2 commits into
openWB:masterfrom
cshagen:update-web-2611
Draft

cshagen wants to merge 2 commits into
openWB:masterfrom
cshagen:update-web-2611

Conversation

@cshagen

@cshagen cshagen commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Summary by Sourcery

Prevent older graph data without prices from causing errors or displaying an invalid price series.

Bug Fixes:

  • Handle graph records without price data and hide the price line when no valid prices exist.

Enhancements:

  • Improve graph scale handling for zero-valued extents and support optional historical price fields.
  • Clean up power meter label markup.

@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 3 issues

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="189" />
<code_context>
 	})
 	// Prices
-	if (currentRow.prices.grid > 0) {
+	if (currentRow.prices && currentRow.prices.grid > 0) {
 		currentItem.price = currentRow.prices.grid * 100000
 	}
</code_context>
<issue_to_address>
**Missing prices become zero**

When a graph contains both rows with prices and rows without valid prices, `transformRow` leaves `price` undefined for rows without a valid price, but `PriceLine` still sends those rows to its line generator. Missing values become zero-price segments or invalid path coordinates, so valid prices render incorrectly; the midpoint label can also receive a NaN position.

Exclude rows without valid prices from the price-line path and its midpoint-label calculation.
</issue_to_address>

### Comment 2
<location path="packages/modules/web_themes/colors/source/src/components/powerGraph/PriceLine.vue" line_range="71" />
<code_context>
 			.range([props.height - 10, 5])
 			.domain(e)
 	} else {
+		showLine.value = false
 		return scaleLinear()
 			.range([props.height - 10, 0])
</code_context>
<issue_to_address>
**Price line stays hidden**

When a mounted `PriceLine` receives a dataset without prices and later receives one with valid prices, `yScale` sets `showLine` to false for the no-price dataset, but the valid-extent branch never sets it back to true, so the root `v-if` keeps the SVG removed and users see no price line.

Set `showLine` to true in the valid-extent branch.
</issue_to_address>

### Comment 3
<location path="packages/modules/web_themes/colors/source/src/components/powerGraph/processDayGraphData.ts" line_range="189" />
<code_context>
 	})
 	// Prices
-	if (currentRow.prices.grid > 0) {
+	if (currentRow.prices && currentRow.prices.grid > 0) {
 		currentItem.price = currentRow.prices.grid * 100000
 	}
</code_context>
<issue_to_address>
**Hovering breaks the tooltip**

When a row without a price is hovered while tariff data is active, `transformRow` leaves `entry.price` undefined, and the active-price tooltip passes it to `formatPrice`, which calls `toFixed` and throws, breaking tooltip rendering.

Guard missing prices before passing `entry.price` to `formatPrice`.
</issue_to_address>

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

})
// Prices
if (currentRow.prices.grid > 0) {
if (currentRow.prices && currentRow.prices.grid > 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 become zero

When a graph contains both rows with prices and rows without valid prices, transformRow leaves price undefined for rows without a valid price, but PriceLine still sends those rows to its line generator. Missing values become zero-price segments or invalid path coordinates, so valid prices render incorrectly; the midpoint label can also receive a NaN position.

Exclude rows without valid prices from the price-line path and its midpoint-label calculation.

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

**Missing prices become zero**

When a graph contains both rows with prices and rows without valid prices, `transformRow` leaves `price` undefined for rows without a valid price, but `PriceLine` still sends those rows to its line generator. Missing values become zero-price segments or invalid path coordinates, so valid prices render incorrectly; the midpoint label can also receive a NaN position.

Exclude rows without valid prices from the price-line path and its midpoint-label calculation.

.range([props.height - 10, 5])
.domain(e)
} else {
showLine.value = false

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 · Price line stays hidden

When a mounted PriceLine receives a dataset without prices and later receives one with valid prices, yScale sets showLine to false for the no-price dataset, but the valid-extent branch never sets it back to true, so the root v-if keeps the SVG removed and users see no price line.

Set showLine to true in the valid-extent branch.

Prompt for AI agents
In `packages/modules/web_themes/colors/source/src/components/powerGraph/PriceLine.vue` at line 71:

**Price line stays hidden**

When a mounted `PriceLine` receives a dataset without prices and later receives one with valid prices, `yScale` sets `showLine` to false for the no-price dataset, but the valid-extent branch never sets it back to true, so the root `v-if` keeps the SVG removed and users see no price line.

Set `showLine` to true in the valid-extent branch.

})
// Prices
if (currentRow.prices.grid > 0) {
if (currentRow.prices && currentRow.prices.grid > 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 · Hovering breaks the tooltip

When a row without a price is hovered while tariff data is active, transformRow leaves entry.price undefined, and the active-price tooltip passes it to formatPrice, which calls toFixed and throws, breaking tooltip rendering.

Guard missing prices before passing entry.price to formatPrice.

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

**Hovering breaks the tooltip**

When a row without a price is hovered while tariff data is active, `transformRow` leaves `entry.price` undefined, and the active-price tooltip passes it to `formatPrice`, which calls `toFixed` and throws, breaking tooltip rendering.

Guard missing prices before passing `entry.price` to `formatPrice`.

@cshagen
cshagen marked this pull request as draft November 18, 2026 07:03
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.

[BUG] Color Theme alte Tageswerte nicht darstellbar nach Upgrade 2.3.0

1 participant