Skip to content

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

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

cshagen wants to merge 4 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 missing or invalid prices in historical graph data from affecting the colors theme power graph.

Bug Fixes:

  • Handle graph data without price information so older records no longer produce invalid price lines or tooltip values.

Enhancements:

  • Make price graph scaling, labeling, and rendering operate only on finite price data.

@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 ✨

@cshagen
cshagen marked this pull request as draft November 18, 2026 07:03
@cshagen
cshagen marked this pull request as ready for review November 18, 2026 17:21
@cshagen

cshagen commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator Author

@sourcery-ai review

@sourcery-ai

sourcery-ai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Linked issues

Checked at commit 252be8b

#4337 [BUG] Color Theme alte Tageswerte nicht darstellbar nach Upgrade 2.3.0 · 1 of 1 met

# Requirement Status Notes
1 Display data for older days whose daily reports have no prices object. ✅ Met The transformation now checks that prices exists before reading prices.grid; the price line and tooltip also exclude missing or invalid prices.

@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/PgToolTipItem.vue" line_range="125" />
<code_context>
 			/>
 			<PgToolTipLine
-				v-if="etData.active"
+				v-if="etData.active && entry.price != null"
 				cat="price"
 				:indent="5"
</code_context>
<issue_to_address>
**Tooltip shows invalid price**

When historical graph data contains a positive price that overflows to `Infinity` during parsing or scaling, `transformRow` retains the overflowing positive price as `Infinity`, and `entry.price != null` passes it to `formatPrice`; unlike `PriceLine`, the tooltip renders `Infinity` as a price, leaving a misleading entry.

Require `Number.isFinite(entry.price)` in the tooltip guard, matching `PriceLine`.

Also at `packages/modules/web_themes/colors/source/src/components/powerGraph/processDayGraphData.ts:189`.
</issue_to_address>

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

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