close
Skip to content

feat: add 'Go to Explore' for combo charts and custom charts#9331

Open
TheRillJon wants to merge 4 commits intomainfrom
jon/combo-charts-drill-down
Open

feat: add 'Go to Explore' for combo charts and custom charts#9331
TheRillJon wants to merge 4 commits intomainfrom
jon/combo-charts-drill-down

Conversation

@TheRillJon
Copy link
Copy Markdown
Contributor

Add "Go to Explore" support for combo_chart and custom_chart canvas components, and fix several pre-existing bugs in the explore link flow for all chart types.

New features:

  • Combo charts drill down to the Pivot page with both y1 and y2 measures as pivot columns
  • Custom charts drill down to the Pivot page using server-returned meta.fields from the metrics SQL resolver to classify columns as dimensions or measures

Bug fixes:

  • Fix crash when pivot URL contains empty rows or cols params — "".split(",") returns [""] not [], which produced invalid pivot chip entries
  • Fix missing time range in all canvas "Go to Explore" URLs — selectedTimeRange was never populated in BaseCanvasComponent's timeRangeState, so explore URLs had no time range
  • Use the relative rill-time expression (e.g. rill-P7D) from rangeStore instead of always generating CUSTOM time ranges
  • Charts with multiple measures or nominal x-axis with dimension color breakout now correctly route to Pivot instead of TDD
  • Skip synthetic color: {type: "value"} fields (used for multi-measure legends) when building pivot state, preventing gRPC UTF-8 marshaling errors
  • Time chip placement: time chips stay in rows when no dimension chips are present; move to columns only when dimension chips exist in rows
  • Bar chart types (bar_chart, stacked_bar, stacked_bar_normalized) now pass through the global comparison time range to explore instead of suppressing it

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!

Developed in collaboration with Claude Code

TheRillJon and others added 4 commits April 29, 2026 02:18
…-existing bugs

Add "Go to Explore" support for combo_chart and custom_chart canvas components,
and fix three bugs (two pre-existing) that prevented correct navigation to the
Explore pivot page.

Files changed:

- Toolbar.svelte: Add "combo_chart" and "custom_chart" to EXPLORE_SUPPORTED_TYPES
- BaseCanvasComponent.ts: Fix pre-existing bug — add `selectedTimeRange` to
  `timeRangeState` for both global and local time intervals, so "Go to Explore"
  includes the time range in the URL for ALL canvas chart types
- ComboChart.ts: Add override `getExploreTransformerProperties()` that explicitly
  maps x, y1, y2 to pivot chips (skipping synthetic color field)
- custom-chart/index.ts: Add `QueryFieldMeta` interface, `queryFieldsMeta`
  writable store, and `getExploreTransformerProperties()` using server-returned
  meta.fields
- CanvasCustomChart.svelte: Add `handleMetaChange` callback to pipe meta.fields
  from the renderer into the component store
- CustomChartRenderer.svelte: Add `onMetaChange` prop and reactive statement to
  emit meta.fields from the first query
- convertURLToExplorePreset.ts: Fix pre-existing empty-string split bug in
  `fromPivotUrlParams()` for both PivotRows and PivotColumns

Bugs fixed:

1. Missing time range (pre-existing, all chart types): BaseCanvasComponent never
   populated `selectedTimeRange` in the `timeRangeState`, so the explore URL
   never included a `tr=` param
2. Synthetic color field (combo-specific): BaseChart.getExploreTransformerProperties()
   processed the combo chart's synthetic color: {type:"value", field:"measures"}
   as a real dimension
3. Empty string split (pre-existing): "".split(",") returns [""] not [], causing
   crashes when PivotRows or PivotColumns are empty

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use the canvas dashboard's rill-time expression (e.g. "24h as of latest/h+1h")
as the time range name instead of always using CUSTOM with absolute dates. Falls
back to CUSTOM only when no named range is available (e.g. a custom date picker
selection or a local chart filter with a custom range).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…t TDD

- Block TDD when y.fields has multiple measures (multi-metric charts)
- Block TDD when both x is nominal and color is a dimension (multiple dims)
- Skip synthetic type:"value" fields (e.g. rill_measures color encoding) in
  transformChartSpecToPivotState so they don't appear as fake dimensions
- Place all non-measure fields in rows initially; when rows contain dimension
  chips, move time chips from rows to columns

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ough

- Combo charts now place x-axis fields in rows initially, matching the
  standard chart behavior: time chips stay in rows when no dimensions
  are present, and move to columns when dimension chips exist in rows.
- Bar chart types (bar_chart, stacked_bar, stacked_bar_normalized) no
  longer force showTimeComparison to false, allowing the global
  comparison time range to pass through to the explore URL.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@TheRillJon TheRillJon requested a review from a team as a code owner April 29, 2026 02:32
@TheRillJon TheRillJon requested a review from djbarnwal April 29, 2026 02:38
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.

1 participant