fix(chart): enable cross-filter on bar charts without dimensions#37407
fix(chart): enable cross-filter on bar charts without dimensions#37407
Conversation
Code Review Agent Run #954415Actionable Suggestions - 0Review 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. |
There was a problem hiding this comment.
Pull request overview
This pull request addresses issue #25334 by enabling cross-filtering on bar charts when no dimensions are configured. The implementation allows users to click on bars to filter other charts by the X-axis category value.
Changes:
- Added
getXAxisCrossFilterDataMask()to create cross-filters using X-axis column and values - Added
handleXAxisChange()to emit X-axis-based cross-filters - Modified click and context menu handlers to support cross-filtering via categorical X-axis when no dimensions exist
- Added unit tests for the new cross-filtering behavior
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.tsx | Implements X-axis based cross-filtering logic and modifies event handlers to support filtering when no dimensions are present |
| superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.test.tsx | Adds tests for categorical X-axis cross-filtering and verifies time-based X-axis doesn't trigger cross-filtering |
superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.tsx
Show resolved
Hide resolved
superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.tsx
Outdated
Show resolved
Hide resolved
superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.tsx
Outdated
Show resolved
Hide resolved
superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.tsx
Show resolved
Hide resolved
Bot Comment AssessmentReviewed the automated review comments on this PR. Here's a summary of relevance: Copilot Comment #1 — String conversion concernLow relevance. The existing dimension-based cross-filter code already converts values to strings (e.g., Copilot Comments #2 & #3 — Undefined check on
|
Code Review Agent Run #dfe61bActionable Suggestions - 0Review 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 |
Code Review Agent Run #193f18Actionable Suggestions - 0Additional Suggestions - 2
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 |
) Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> (cherry picked from commit ae10e10)
Summary
Fixes #25334 - Bar charts now emit cross-filters using the X-axis category value when no dimensions are configured.
The Problem:
When a bar chart has no "Dimensions" field set, clicking on a bar did nothing - cross-filtering was completely disabled. Users expected clicking on a bar (e.g., "Product A") to filter other charts by that X-axis value.
The Fix:
When no dimensions exist but the X-axis is categorical, use the X-axis column/value for cross-filtering:
getXAxisCrossFilterDataMask()- creates cross-filter using X-axis column and clicked valuehandleXAxisChange()- emits the X-axis-based cross-filtercanCrossFilterByXAxis(categorical X-axis without dimensions)Before: Clicking a bar with no dimensions → nothing happens
After: Clicking a bar with no dimensions → filters by X-axis category value
Test plan
Technical Details
The key insight was that the X-axis value is available in
props.data[0]during click events, but was never used for cross-filtering. The contextmenu handler already had logic to extract this value for drill-to-detail, so the fix follows the same pattern.🤖 Generated with Claude Code