Skip to content

fix: render previous-period comparison lines in the TDD line chart - #9817

Merged
nishantmonu51 merged 1 commit into
mainfrom
nishant/fix-tdd-line-chart-comparison
Aug 19, 2026
Merged

fix: render previous-period comparison lines in the TDD line chart#9817
nishantmonu51 merged 1 commit into
mainfrom
nishant/fix-tdd-line-chart-comparison

Conversation

@nishantmonu51

Copy link
Copy Markdown
Collaborator

In the Time Dimension Detail view with time comparison on, the Vega chart types (grouped bar, stacked bar, stacked area) render a faded mark per dimension value for the previous period, but the line chart rendered nothing: buildChartSeries only emitted current-period series, even though the per-dimension comparison values were already fetched and merged into DimensionSeriesData.

  • Previous-period lines. buildChartSeries now emits a comparison series per dimension value in the same color, faded to the same opacity the Vega comparison marks use — extracted as ComparisonMarkOpacity in comparison-builder.ts so both renderers stay in sync. The series order keeps every faded line beneath every current-period line, since TimeSeriesChart paints series[0] last.
  • Y extent. computeYExtent now includes dimension comparison values when comparison is shown, so a previous period that peaks above the current one is not clipped.
  • Hover snapping. snapSeries in MeasureChartBody includes the dimension comparison points, so trailing buckets where only previous-period data exists yet (e.g. an incomplete current day) are hoverable.

Checklist:

  • Covered by tests
  • Ran it and it works as intended
  • Reviewed the diff before requesting a review
  • Checked for unhandled edge cases
  • Linked the issues it closes
  • Checked if the docs need to be updated. If so, create a separate Linear DOCS issue
  • Intend to cherry-pick into the release branch
  • I'm proud of this work!

https://claude.ai/code/session_01HZg85dzz4bkcY53V1AEa7z

With time comparison on and dimension values selected, the Vega TDD charts
(grouped bar, stacked bar, stacked area) render a faded mark per dimension
value for the previous period, but the custom SVG line chart dropped the
comparison data entirely: `buildChartSeries` only emitted current-period
series, even though the per-dimension comparison values were already fetched
and merged into `DimensionSeriesData`.

- Emit a previous-period series per dimension value in the same color,
  faded to the same opacity the Vega comparison marks use; the value is
  extracted as `ComparisonMarkOpacity` in `comparison-builder.ts` so both
  renderers stay in sync. The series order keeps every faded line beneath
  every current-period line, since `TimeSeriesChart` paints `series[0]` last.
- Include dimension comparison values in `computeYExtent`, so a previous
  period that peaks above the current one is not clipped.
- Let hover snapping reach dimension comparison points, which matters for
  trailing buckets where only previous-period data exists yet.

Claude-Session: https://claude.ai/code/session_01HZg85dzz4bkcY53V1AEa7z
@nishantmonu51
nishantmonu51 merged commit 674ab65 into main Aug 19, 2026
22 of 24 checks passed
@nishantmonu51
nishantmonu51 deleted the nishant/fix-tdd-line-chart-comparison branch August 19, 2026 15:11
nishantmonu51 added a commit that referenced this pull request Aug 20, 2026
…9817)

With time comparison on and dimension values selected, the Vega TDD charts
(grouped bar, stacked bar, stacked area) render a faded mark per dimension
value for the previous period, but the custom SVG line chart dropped the
comparison data entirely: `buildChartSeries` only emitted current-period
series, even though the per-dimension comparison values were already fetched
and merged into `DimensionSeriesData`.

- Emit a previous-period series per dimension value in the same color,
  faded to the same opacity the Vega comparison marks use; the value is
  extracted as `ComparisonMarkOpacity` in `comparison-builder.ts` so both
  renderers stay in sync. The series order keeps every faded line beneath
  every current-period line, since `TimeSeriesChart` paints `series[0]` last.
- Include dimension comparison values in `computeYExtent`, so a previous
  period that peaks above the current one is not clipped.
- Let hover snapping reach dimension comparison points, which matters for
  trailing buckets where only previous-period data exists yet.

Claude-Session: https://claude.ai/code/session_01HZg85dzz4bkcY53V1AEa7z
(cherry picked from commit 674ab65)
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.

2 participants