rusackas opened a new pull request, #41311:
URL: https://github.com/apache/superset/pull/41311
### SUMMARY
Fixes #21734
Prophet forecast confidence intervals appeared to "disappear" in the chart
tooltip whenever the forecast crossed zero. The root cause is in the ECharts
time-series forecast tooltip formatter
(`superset-frontend/plugins/plugin-chart-echarts/src/utils/forecast.ts`), which
used **truthiness** checks on the forecast values:
```ts
if (forecastTrend) { ... } // a trend of exactly 0 is skipped
if (forecastLower && forecastUpper) { } // a bound/height of 0 drops the
whole band
```
Because `0` is falsy in JS, a legitimate forecast trend of `0`, a lower
bound of `0`, or a zero-height band caused the corresponding values to be
silently omitted from the tooltip. This matches the report in #21734 ("if the
central estimate crosses 0, they are gone").
The fix switches these to explicit `typeof value === 'number'` checks — the
same pattern already used for the `observation` value just above — so zero
values are formatted and displayed like any other number.
Backend was already verified clean by the earlier test-only TDD guard
(#40141): the Prophet wrapper does not clamp at zero. This PR addresses the
remaining frontend rendering bug.
### BEFORE/AFTER
- **Before:** a forecast point with `ŷ = 0`, or a confidence bound of `0`,
rendered no trend/interval in the tooltip.
- **After:** `ŷ = 0` and intervals like `(0, 7)` or `(4, 4)` render
correctly.
### TESTING INSTRUCTIONS
```bash
cd superset-frontend
npx jest plugins/plugin-chart-echarts/test/utils/forecast.test.ts
```
Four new unit tests pin the zero-crossing behavior (trend = 0, lower = 0,
zero-height band, all-zero). They fail on `master` and pass with this change.
### ADDITIONAL INFORMATION
- [x] Has associated issue: Fixes #21734
- [ ] Required feature flags:
- [x] Changes UI (forecast tooltip rendering)
- [ ] Includes DB Migration
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]