jtjenkins opened a new pull request, #39913:
URL: https://github.com/apache/superset/pull/39913

   ## Summary
   
   Cross-filtering is silently broken in 6.0.0 for the most common bar chart 
pattern: charts that use a categorical `x_axis` column with no `groupby` series 
breakdown.
   
   This is a backport of the fix already merged to `master` (issue #25334) to 
the `6.0-bug-fixes` branch.
   
   ### Root cause
   
   `EchartsTimeseries.tsx` only emits a `crossFilter` object when 
`hasDimensions` is true (`groupby` is non-empty):
   
   ```typescript
   crossFilter: hasDimensions
     ? getCrossFilterDataMask(seriesName)
     : undefined,   // ← always undefined when groupby is []
   ```
   
   This was fine before PR #31582, which moved the categorical X-axis column 
from `groupby` to the dedicated `x_axis` field. After that migration, charts 
that only define an X-axis category have `groupby = []`, so `hasDimensions = 
false` and cross-filtering is permanently disabled — both right-click "Add 
Cross Filter" (appears grayed out) and left-click selection.
   
   ### Fix
   
   Introduces `canCrossFilterByXAxis = !hasDimensions && xAxis.type === 
AxisType.Category` and a parallel `getXAxisCrossFilterDataMask` helper that 
builds the filter on `xAxis.label` from the clicked bar's category value 
(`props.data[0]`). Both the `click` and `contextmenu` handlers are updated to 
use this path when `groupby` is empty but the X-axis is categorical.
   
   Toggle/deselect uses `Object.values(selectedValues)`, consistent with the 
existing `getCrossFilterDataMask` behaviour.
   
   ### Changes
   
   - 
`superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.tsx`
   
   ### Testing
   
   Verified end-to-end in a Superset 6.0 instance:
   - Bar chart with `x_axis = clinical_stage`, `groupby = []`
   - Right-click → "Add Cross Filter" is now enabled (was grayed out)
   - Left-click on a bar applies `clinical_stage IN [value]` and all connected 
charts update
   - Clicking the same bar again deselects (toggle behaviour)
   - Charts with `groupby` set continue to use the original dimension-based 
cross-filter path
   
   ### Notes
   
   The equivalent fix was already applied to `master` (see issue #25334). This 
PR backports only the cross-filter change to `6.0-bug-fixes`, with no unrelated 
changes from `master`.
   
   Fixes #25334 (backport to 6.0)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to