feat(chart): enable cross-filter on temporal x-axis (bar/label click) - #42792
feat(chart): enable cross-filter on temporal x-axis (bar/label click)#42792reveha wants to merge 3 commits into
Conversation
- Extend canCrossFilterByXAxis to support AxisType.Time in addition to AxisType.Category, gated by !hasDimensions - Add temporal TEMPORAL_RANGE data mask generation using createTimeRangeFromGranularity (day/month/year granularities) - Apply +1ms adjustment to convert inclusive end to backend's upper-exclusive bound, per get_time_filter semantics in superset/models/helpers.py - Add triggerEvent: true for temporal x-axis when no dimensions are set, enabling axis-label click events - Register orientation-aware query event handler (xAxis/yAxis) guarded by targetType === 'axisLabel' for both categorical and temporal label clicks - Fix horizontal-orientation point click reading the wrong tuple index (metric value instead of axis value) for the temporal cross-filter path, using the same orientation-aware extraction as the categorical path - Add regression tests covering day/month/year point-click and axis-label-click payloads, toggle behavior, horizontal/vertical orientation, and no-op behavior when dimensions are set
Code Review Agent Run #6ac577Actionable Suggestions - 0Additional Suggestions - 1
Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #42792 +/- ##
==========================================
+ Coverage 65.79% 65.81% +0.02%
==========================================
Files 2842 2842
Lines 162106 162169 +63
Branches 37148 37183 +35
==========================================
+ Hits 106653 106738 +85
+ Misses 53388 53366 -22
Partials 2065 2065
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
This PR enables cross-filtering on temporal (time) X-axes for ECharts timeseries charts when no dimensions are set, including both point clicks and axis-label clicks.
Changes:
- Enable
triggerEventforAxisType.TimeX-axes (whengroupbyis empty) to support axis-label click events. - Add temporal
TEMPORAL_RANGEdata mask generation based on configured time grain (with an upper-exclusive end). - Update click/label-click handlers to be orientation-aware and support time axes; add regression tests for the new behaviors.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformProps.test.ts | Adds a regression test ensuring temporal x-axis enables triggerEvent when no dimensions are set. |
| superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts | Extends triggerEvent enabling logic to include AxisType.Time. |
| superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.tsx | Implements temporal x-axis cross-filtering via point/label clicks and orientation-aware value extraction. |
| superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.test.tsx | Adds extensive tests for temporal cross-filter payloads, toggling, and orientation behavior. |
| superset-frontend/packages/superset-ui-core/src/time-format/index.ts | Exposes createTimeRangeFromGranularity from @superset-ui/core. |
…s-filter - Use resolvedTimeGrain (dashboard-level override aware) instead of formData.timeGrainSqla directly when generating temporal cross-filter masks, keeping click behavior consistent with the rendered axis grain - Add missing AxisType.Time branch to context-menu cross-filter generation, matching existing point-click support - Fix lint/typecheck/pre-commit CI failures - Add regression tests for both fixes
…, logging, formatting, tests) - Handle string-typed axis values in temporal point-click path, matching axis-label click parsing - Replace console.warn with project logging convention - Verify/harden millisecond precision in temporal range end formatting to protect the +1ms exclusivity adjustment - Switch debounce-dependent tests to Jest fake timers for speed and determinism - Add regression tests to close Codecov-reported coverage gaps
Code Review Agent Run #4f9369Actionable Suggestions - 0Additional Suggestions - 1
Filtered by Review RulesBito filtered these suggestions based on rules created automatically for your feedback. Manage rules.
Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
SUMMARY
Currently, clicking a bar or an axis label on a time-based (temporal) X-axis
does not trigger cross-filtering when no dimension/groupby is set — unlike the
existing categorical X-axis cross-filter support (#37407, #41111). This PR
extends that same no-dimension cross-filter capability to temporal X-axes.
canCrossFilterByXAxisto supportAxisType.Timein addition toAxisType.Category, gated by!hasDimensionsTEMPORAL_RANGEdata mask generation usingcreateTimeRangeFromGranularity(day/month/year granularities)backend's upper-exclusive bound, per
get_time_filtersemantics insuperset/models/helpers.pytriggerEvent: truefor temporal X-axis when no dimensions are set,enabling axis-label click events
xAxis/yAxis) guardedby
targetType === 'axisLabel', covering both categorical and temporallabel clicks
(metric value instead of axis value) for the temporal cross-filter path,
using the same orientation-aware extraction already used for the
categorical path
axis-label-click payloads, toggle behavior, horizontal/vertical
orientation, and no-op behavior when dimensions are set
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A — behavioral fix, no UI changes.
TESTING INSTRUCTIONS
echarts_timeseries_bar) with no dimension/groupby,a temporal X-axis column, and any time grain (day/month/year).
column, and enable cross-filtering.
TEMPORAL_RANGEfilter.the bar.
orientation: horizontal— verify the correct timebucket is used (not the metric value).
trigger this temporal cross-filter path (existing dimension-based
behavior applies instead).
Automated:
npm run test -- EchartsTimeseries.test.tsx transformProps.test.tsADDITIONAL INFORMATION