Repository navigation
feat(plots): show benchmark plots up to 2050 only - #1021
Conversation
Pathways end anywhere from 2030 to 2100 (NGFS), so plots side by side had wildly different x-axes and were hard to compare. * capToPlotYears (src/utils/plotYears.ts) drops rows after MAX_PLOT_YEAR = 2050. PlotGrid and ComparisonPlots apply it where rows enter, so everything derived from them agrees with what is drawn: which panels show, segment badges, and above all the comparison page's shared y-axis, which would otherwise stretch to values past 2050 that no chart shows. * Downloads are untouched and keep every year. The download box says so when the plotted dataset runs past 2050, since its "2020 → 2100" summary sits next to plots that stop at 2050. Closes #1010 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Expected version change and release notes🚨 WARNING: This PR is not expected to trigger a new versionTo trigger a version bump, use at least one conventional commit message in this branch. See: https://www.conventionalcommits.org/en/v1.0.0/ |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://proud-glacier-0f640931e-1021.westus2.2.azurestaticapps.net |
There was a problem hiding this comment.
🟡 Changes recommended
Comparison entries reduced to one year still affect shared y-axis bounds despite their charts being hidden.
1 open issue
What changed in this PR
This PR addresses #1010 by limiting benchmark plot data to years through 2050 on pathway and comparison pages, while preserving complete downloads.
Changes:
- Adds shared year-filtering helpers and applies them before deriving plot content and axis bounds.
- Adds a download notice when the plotted dataset extends beyond 2050.
- Adds tests for filtering, panel visibility, comparison scaling, and the download notice.
| File | Description |
|---|---|
src/utils/plotYears.ts |
Defines the year cap and filtering helpers. |
src/utils/plotYears.test.ts |
Tests filtering and detection of later years. |
src/pages/PathwayDetailPage.tsx |
Enables the notice for the plotted dataset’s download. |
src/components/PlotGrid.tsx |
Caps detail-page data before deriving panels. |
src/components/PlotGrid.test.tsx |
Tests capped chart data and single-year panel removal. |
src/components/DownloadDataset.tsx |
Explains that downloads retain every year. |
src/components/DownloadDataset.test.tsx |
Tests conditional download notice rendering. |
src/components/ComparisonPlots.tsx |
Caps comparison data before deriving chart state. |
src/components/ComparisonPlots.test.tsx |
Tests year filtering and exclusion of later peaks from bounds. |
Review effort: Balanced
Capping at 2050 can leave a comparison column with one year. PlotPanel hides that chart, but its values still set the shared y-axis bounds and flattened the charts that are shown. Skip entries without a plottable series when computing the bounds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Expected version change and release notes🚨 WARNING: This PR is not expected to trigger a new versionTo trigger a version bump, use at least one conventional commit message in this branch. See: https://www.conventionalcommits.org/en/v1.0.0/ |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://proud-glacier-0f640931e-1021.westus2.2.azurestaticapps.net |
There was a problem hiding this comment.
🟢 Approval recommended
The cutoff consistently precedes plot calculations, downloads remain unchanged, and the previously reported shared-axis issue is fixed with regression coverage.
No open issues 🎉
1 resolved since last review
Review effort: Balanced

Closes #1010
Pathways end anywhere from 2030 to 2100 (the NGFS data runs to 2100), so benchmark plots had very different x-axes and were hard to compare. All benchmark plots, on the pathway page and the comparison page, now stop at 2050. Downloads still contain every year.
How
src/utils/plotYears.ts:MAX_PLOT_YEAR = 2050andcapToPlotYears(), which drops rows after 2050.PlotGrid(pathway page) andComparisonPlots(comparison page) apply it where the rows come in, before anything else is worked out from them. That keeps everything consistent with what is drawn:The download is unchanged, and says so
The download box summarises the file, e.g. "2020 → 2100", right below plots that now stop at 2050. When the plotted dataset runs past 2050, the box adds one line: "The plots on this page show years up to 2050. This download contains every year."
Checks
npx vitest run: 1359 passing. New tests cover:npm run lint,npm run format:check: clean.tscreports the same 203 errors asepic/v2already does, none in the changed files.🤖 Generated with Claude Code