Skip to content

fix(chart): enable cross-filter on bar charts without dimensions#37407

Merged
rusackas merged 3 commits intomasterfrom
fix/bar-chart-cross-filter-without-dimensions
Feb 1, 2026
Merged

fix(chart): enable cross-filter on bar charts without dimensions#37407
rusackas merged 3 commits intomasterfrom
fix/bar-chart-cross-filter-without-dimensions

Conversation

@rusackas
Copy link
Member

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:

  • Added getXAxisCrossFilterDataMask() - creates cross-filter using X-axis column and clicked value
  • Added handleXAxisChange() - emits the X-axis-based cross-filter
  • Modified click handler to check canCrossFilterByXAxis (categorical X-axis without dimensions)
  • Updated context menu to provide X-axis cross-filter option

Before: Clicking a bar with no dimensions → nothing happens
After: Clicking a bar with no dimensions → filters by X-axis category value

Test plan

  • Added unit tests for new cross-filter behavior
  • Existing tests pass
  • Manual testing: Create a bar chart without dimensions, click on bars to verify cross-filtering works

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

@bito-code-review
Copy link
Contributor

bito-code-review bot commented Jan 23, 2026

Code Review Agent Run #954415

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: 09c44cf..09c44cf
    • superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.test.tsx
    • superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@dosubot dosubot bot added the viz:charts:bar Related to the Bar chart label Jan 23, 2026
@netlify
Copy link

netlify bot commented Jan 23, 2026

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit c18e125
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/697a3cea2bd8c00008b6a1d7
😎 Deploy Preview https://deploy-preview-37407--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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

@rusackas rusackas requested a review from sadpandajoe January 27, 2026 20:14
@rusackas
Copy link
Member Author

Bot Comment Assessment

Reviewed the automated review comments on this PR. Here's a summary of relevance:

Copilot Comment #1 — String conversion concern

Low relevance. The existing dimension-based cross-filter code already converts values to strings (e.g., String(...) is used throughout the codebase for filter values). This follows the established pattern.

Copilot Comments #2 & #3 — Undefined check on props.data[0]

Valid minor improvement. The code checks props.data for truthiness but doesn't guard against an empty array, so props.data[0] could be undefined. In practice this is unlikely to cause issues (an empty-data chart wouldn't fire click/context-menu events on data points), but adding props.data?.[0] would be a defensive improvement.

Copilot Comment #4 — Visual feedback mismatch with selectedValues

Valid and important. This is a real concern. When cross-filtering by X-axis value, selectedValues will contain X-axis values (e.g., "Product A"). However, transformers.ts line 241 checks !filterState?.selectedValues.includes(name) where name is the series name (e.g., "Sales"). Since X-axis values won't match series names, all series will appear dimmed — the visual highlight feedback won't work correctly for X-axis cross-filtering.

This would need a fix in the opacity/highlight logic in transformers.ts to distinguish between dimension-based filtering (matches series names) and X-axis filtering (matches data point X values).

bito-code-review bot

No actionable items — generic summary, no specific concerns raised.

netlify bot

Standard deploy preview link — not a review comment.

@bito-code-review
Copy link
Contributor

bito-code-review bot commented Jan 27, 2026

Code Review Agent Run #dfe61b

Actionable Suggestions - 0
Review Details
  • Files reviewed - 5 · Commit Range: 09c44cf..343185a
    • superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.test.tsx
    • superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.tsx
    • superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts
    • superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformers.ts
    • superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformers.test.ts
  • Files skipped - 0
  • Tools
    • Eslint (Linter) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@EnxDev EnxDev added the 🎪 ⚡ showtime-trigger-start Create new ephemeral environment for this PR label Jan 28, 2026
@github-actions github-actions bot added 🎪 343185a 🚦 building Environment 343185a status: building 🎪 343185a 📅 2026-01-28T09-26 Environment 343185a created at 2026-01-28T09-26 🎪 343185a 🤡 EnxDev Environment 343185a requested by EnxDev 🎪 ⌛ 48h Environment expires after 48 hours (default) and removed 🎪 ⚡ showtime-trigger-start Create new ephemeral environment for this PR labels Jan 28, 2026
@github-actions
Copy link
Contributor

🎪 Showtime is building environment on GHA for 343185a

@github-actions github-actions bot added 🎪 343185a 🚦 deploying Environment 343185a status: deploying 🎪 343185a 🚦 failed Environment 343185a status: failed and removed 🎪 343185a 🚦 building Environment 343185a status: building 🎪 343185a 🚦 deploying Environment 343185a status: deploying labels Jan 28, 2026
@EnxDev EnxDev added the 🎪 ⚡ showtime-trigger-start Create new ephemeral environment for this PR label Jan 28, 2026
@github-actions github-actions bot added 🎪 343185a 🚦 building Environment 343185a status: building and removed 🎪 ⚡ showtime-trigger-start Create new ephemeral environment for this PR 🎪 343185a 🚦 failed Environment 343185a status: failed 🎪 343185a 🤡 EnxDev Environment 343185a requested by EnxDev 🎪 343185a 📅 2026-01-28T09-26 Environment 343185a created at 2026-01-28T09-26 labels Jan 28, 2026
@github-actions github-actions bot added the 🎪 c18e125 🤡 rusackas Environment c18e125 requested by rusackas label Jan 28, 2026
@github-actions
Copy link
Contributor

🎪 Showtime is building environment on GHA for c18e125

@github-actions github-actions bot added 🎪 c18e125 🚦 deploying Environment c18e125 status: deploying 🎪 c18e125 🚦 failed Environment c18e125 status: failed and removed 🎪 c18e125 🚦 building Environment c18e125 status: building 🎪 c18e125 🚦 deploying Environment c18e125 status: deploying labels Jan 28, 2026
@bito-code-review
Copy link
Contributor

bito-code-review bot commented Jan 28, 2026

Code Review Agent Run #193f18

Actionable Suggestions - 0
Additional Suggestions - 2
  • superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformers.test.ts - 2
    • Avoid `any` type in test assertions · Line 104-104
      The use of `as any` here violates the repository's TypeScript guidelines, which prohibit `any` types to ensure type safety. Since `transformSeries` returns `SeriesOption | undefined` and `itemStyle` is typed as `ItemStyleOption` with an `opacity` property, proper casting maintains correctness without sacrificing type checking.
    • Avoid `any` type in test assertions · Line 118-118
      Similar to the above, this `as any` cast should be replaced with proper typing to align with the repository's TypeScript standards. The `itemStyle.opacity` is correctly typed in the echarts SeriesOption interface.
Review Details
  • Files reviewed - 5 · Commit Range: 40b1bc0..c18e125
    • superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.test.tsx
    • superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.tsx
    • superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts
    • superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformers.ts
    • superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformers.test.ts
  • Files skipped - 0
  • Tools
    • Eslint (Linter) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@github-actions github-actions bot added 🎪 c18e125 🚦 building Environment c18e125 status: building 🎪 c18e125 📅 2026-01-29T17-25 Environment c18e125 created at 2026-01-29T17-25 🎪 c18e125 🤡 rusackas Environment c18e125 requested by rusackas and removed 🎪 c18e125 🚦 failed Environment c18e125 status: failed 🎪 c18e125 📅 2026-01-28T16-45 Environment c18e125 created at 2026-01-28T16-45 🎪 c18e125 🤡 rusackas Environment c18e125 requested by rusackas labels Jan 29, 2026
@github-actions
Copy link
Contributor

🎪 Showtime is building environment on GHA for c18e125

@github-actions github-actions bot added 🎪 c18e125 🚦 deploying Environment c18e125 status: deploying 🎪 c18e125 🚦 failed Environment c18e125 status: failed and removed 🎪 c18e125 🚦 building Environment c18e125 status: building 🎪 c18e125 🚦 deploying Environment c18e125 status: deploying 🎪 343185a 🤡 EnxDev Environment 343185a requested by EnxDev 🎪 343185a 🚦 failed Environment 343185a status: failed 🎪 343185a 📅 2026-01-28T14-02 Environment 343185a created at 2026-01-28T14-02 🎪 c18e125 🤡 rusackas Environment c18e125 requested by rusackas 🎪 c18e125 📅 2026-01-29T17-25 Environment c18e125 created at 2026-01-29T17-25 🎪 c18e125 🚦 failed Environment c18e125 status: failed labels Jan 29, 2026
@rusackas rusackas merged commit ae10e10 into master Feb 1, 2026
70 of 78 checks passed
@rusackas rusackas deleted the fix/bar-chart-cross-filter-without-dimensions branch February 1, 2026 01:14
sadpandajoe pushed a commit that referenced this pull request Feb 2, 2026
)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
(cherry picked from commit ae10e10)
@sadpandajoe sadpandajoe added the v6.0 Label added by the release manager to track PRs to be included in the 6.0 branch label Feb 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

plugins size/L v6.0 Label added by the release manager to track PRs to be included in the 6.0 branch viz:charts:bar Related to the Bar chart 🎪 ⌛ 48h Environment expires after 48 hours (default)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bar chart does not emit cross-filter if dimension is not set

4 participants