Skip to content

feat: per-widget hide_comparison toggle for canvas components - #9913

Open
nishantmonu51 wants to merge 3 commits into
mainfrom
nishant/canvas-hide-comparison
Open

nishantmonu51 wants to merge 3 commits into
mainfrom
nishant/canvas-hide-comparison

Conversation

@nishantmonu51

@nishantmonu51 nishantmonu51 commented Sep 21, 2026

Copy link
Copy Markdown
Collaborator

When comparison is enabled on a canvas it applies to every widget. This makes comparison its own per-widget axis so a component can turn it off, or compare against its own range, independently of the canvas toggle and of a local time range.

  • New comparison_range renderer property on canvas data components (KPI grid, table/pivot, leaderboard, cartesian charts). Absent inherits the canvas comparison, none turns it off, and a comparison range (rill-PW, a custom start,end pair, ...) overrides it. Comparison intervals are computed against the component's effective time range, local or canvas.
  • Inspector: one "Time comparison" selector in the "Time & filters" tab with Inherit from canvas / Off / the comparison presets / Custom. The inherit entry shows what the canvas currently compares against. This replaces the separate toggle and the local comparison pill, so the UI always mirrors the YAML.
  • Back-compat: compare_tr inside time_filters is still read (a local time range without it keeps meaning "no comparison", as today) but is no longer written. Enabling a local time range from the UI writes comparison_range: inherit so the widget keeps the comparison the user sees.
  • Resolved in one place, BaseCanvasComponent.timeAndFilterStore, since every widget and the open-in-explore link read showTimeComparison from that derived store. updateProperties writes several spec keys in a single YAML update. No backend, proto, or schema change needed.
  • The inspector's "Filters" tab is renamed to "Time & filters" since it holds time range, comparison, and dimension filter overrides.
  • Docs updated in the canvas data widgets page and the AI canvas instructions; i18n keys added in en.json and es.json.
  • E2e coverage in web-local/tests/canvas/filters.spec.ts: a widget can turn comparison off and back to inherit while the canvas comparison stays on; the local time range test now picks its comparison from the new selector.

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!

Adds a `hide_comparison: true` renderer property that turns delta/comparison off
for a single canvas component regardless of the canvas-level comparison toggle
or a local `time_filters` override. Exposed in the inspector Filters tab as a
"Time comparison" switch next to "Local time range".
The tab now holds time range, comparison, and dimension filter overrides.
Uses a new message key since `canvas_filters` also labels a filter input.

@AdityaHegde AdityaHegde left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding a separate toggle makes this confusing. In the example I have toggled the new setting on and have comparison in top level filters, but have toggled off local comparison, leading to a mismatch. But if the new toggle is off comparison selector is not shown at all while the yaml still has it like time_filters: tr=7D+as+of+latest%2FD%2B1D&compare_tr=rill-PP So there is a mismatch in how things are interpreted.

Image

Not a 100% sure what will make this consistent. Perhaps we can add inherit option to time and comparison selectors?

Comparison becomes its own axis on canvas components, independent of the
local time range: absent inherits the canvas comparison, `none` turns it
off, and any comparison range overrides it. The inspector shows one
selector with Inherit / Off / ranges instead of a separate toggle, so the
UI and YAML can no longer disagree.

`compare_tr` inside `time_filters` is still read for existing projects but
no longer written.

This branch has not been deployed

No deployments
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