You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "alex-poor (via GitHub)" <gi...@apache.org> on 2026/06/16 06:16:13 UTC

[I] Cross-filter on a horizontal bar chart (no dimensions) emits the metric value instead of the x-axis category [superset]

alex-poor opened a new issue, #41102:
URL: https://github.com/apache/superset/issues/41102

   # Cross-filter on a horizontal bar chart (no dimensions) emits the metric value instead of the x-axis category
   
   ### Bug description
   
   Cross-filtering by x-axis value on `echarts_timeseries_bar` charts that have **no dimensions** (added in #37407 for #25334, and backported to 6.0 in #39913) does not work when the chart's **orientation is horizontal**. Clicking a bar emits a cross-filter whose value is the **metric (count) value** rather than the **x-axis category**, so every other chart on the dashboard is filtered down to zero rows.
   
   The same chart with `orientation: vertical` works correctly.
   
   ### Root cause
   
   In `superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.tsx`, the `click` event handler cross-filters using `props.data[0]`:
   
   ```ts
   } else if (canCrossFilterByXAxis && props.data?.[0] != null) {
     // Cross-filter by X-axis value when no dimensions (issue #25334)
     handleXAxisChange(props.data[0]);
   }
   ```
   
   `getXAxisCrossFilterDataMask` then builds the filter as:
   
   ```ts
   filters: [{ col: xAxis.label, op: 'IN', val: [String(xAxisValue)] }]
   ```
   
   For a **vertical** bar the ECharts data tuple is `[category, value]`, so `data[0]` is the category — correct.
   For a **horizontal** bar the tuple is effectively `[value, category]`, so `data[0]` is the **metric value**. The emitted filter becomes e.g. `my_category_col IN ['54886']`, which matches no rows, and all in-scope charts return empty.
   
   Note the **context-menu / drill-to-detail** handler in the same file already does this correctly by using the orientation-independent `eventParams.name`:
   
   ```ts
   const values = [...(eventParams.name ? [eventParams.name] : []), ...(labelMap[seriesName] ?? [])];
   ```
   
   The cross-filter click path should likewise use the category name (`props.name`) rather than `props.data[0]`.
   
   ### How to reproduce
   
   1. Create a dataset with a categorical text column (e.g. `category`) and some rows.
   2. Create a **Bar Chart** (`echarts_timeseries_bar`):
      - X-axis: `category` (categorical, not temporal)
      - Metric: `COUNT(*)`
      - **Dimensions: leave empty**
      - **Orientation: Horizontal**
   3. Add it to a dashboard with at least one other chart on the same/related dataset, with cross-filters enabled.
   4. Click a bar.
   
   **Expected:** other charts filter to the clicked category (e.g. `category = 'European'`).
   **Actual:** other charts go to zero rows. Inspecting the applied cross-filter shows the value is the bar's count, not the category.
   
   Setting the same chart's orientation to **Vertical** makes cross-filtering work as expected.
   
   ### Proposed fix
   
   In the `click` handler, pass the category name instead of the value-axis element so it is orientation-independent, e.g.:
   
   ```ts
   } else if (canCrossFilterByXAxis && props.name != null) {
     handleXAxisChange(props.name);
   }
   ```
   
   (or select `props.data[0]` vs `props.data[1]` based on `orientation`).
   
   ### Environment
   
   - Superset version: 6.0.0 (also present on `master`). The offending `props.data[0]` access was introduced in #37407 and is carried unchanged into the 6.0 backport #39913 — neither handles horizontal orientation.
   - Affected viz: `echarts_timeseries_bar` with categorical x-axis, no dimensions, `orientation: horizontal`
   - Browser: any
   
   ### Checklist
   
   - [x] I have searched Superset docs and GitHub issues for a similar report and found none.
   - [x] I have reproduced the issue with the latest relevant code path (#37407).
   


-- 
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: notifications-unsubscribe@superset.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] Cross-filter on a horizontal bar chart (no dimensions) emits the metric value instead of the x-axis category [superset]

Posted by "alex-poor (via GitHub)" <gi...@apache.org>.
alex-poor commented on issue #41102:
URL: https://github.com/apache/superset/issues/41102#issuecomment-4736170899

   thanks @rusackas marked ready for review and checked CI Passes 👍 


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] Cross-filter on a horizontal bar chart (no dimensions) emits the metric value instead of the x-axis category [superset]

Posted by "BMPMS (via GitHub)" <gi...@apache.org>.
BMPMS commented on issue #41102:
URL: https://github.com/apache/superset/issues/41102#issuecomment-5204347540

   Hi @rusackas - so I've come across this charming bug.  How easy is it to merge this into my current version - can I run some sort of update from main command that will fix it or is it more than that.  It's a crazy bug to have, super restrictive!


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] Cross-filter on a horizontal bar chart (no dimensions) emits the metric value instead of the x-axis category [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #41102:
URL: https://github.com/apache/superset/issues/41102#issuecomment-4733145666

   Thanks for digging in and opening a PR. Holler when it's out of draft mode and we'll review it!


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] Cross-filter on a horizontal bar chart (no dimensions) emits the metric value instead of the x-axis category [superset]

Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #41102:
URL: https://github.com/apache/superset/issues/41102#issuecomment-4715591879

   <!-- Answer -->
   Your analysis looks correct. Looking at the PR #37407 diff, the click handler uses `props.data[0]` to get the X-axis value [[1]](https://github.com/apache/superset/pull/37407):
   
   ```ts
   } else if (canCrossFilterByXAxis && props.data?.[0] != null) {
     handleXAxisChange(props.data[0]);
   }
   ```
   
   For vertical bars, `data[0]` is the category — but for horizontal bars the tuple is flipped, so `data[0]` is the metric value instead.
   
   The test confirms this assumption — it only tests with `data: ['Product A', 100]` (vertical orientation) [[1]](https://github.com/apache/superset/pull/37407).
   
   Your proposed fix of using `props.name` instead of `props.data[0]` is the right approach. The context menu handler in the same file already uses `eventParams.name` for orientation-independent category access [[2]](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.tsx#L182-L185), so this would make the cross-filter path consistent:
   
   ```ts
   } else if (canCrossFilterByXAxis && props.name != null) {
     handleXAxisChange(props.name);
   }
   ```
   
   The same change should also be applied to the context menu's cross-filter section in the same PR, which has the identical `data?.[0]` pattern:
   
   ```ts
   } else if (canCrossFilterByXAxis && data?.[0] != null) {
     crossFilter = getXAxisCrossFilterDataMask(data[0]);
   }
   ```
   
   This should use `eventParams.name` as well to remain orientation-agnostic.
   
   
   <!-- Dosu Comment Footer -->
   *To reply, just mention [@dosu](https://go.dosu.dev/dosubot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=reply-with-mention&utm_term=apache%2Fsuperset).*
   
   ---
   
   Share context across your team and agents. Try [Dosu](https://dosu.dev?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-tagline&utm_term=apache%2Fsuperset).
   
   [![Leave Feedback](https://img.shields.io/badge/Leave%20Feedback-555555?style=flat)](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-feedback&utm_term=apache%2Fsuperset&message_id=f1a617a4-11d7-4964-a9b0-17e53614a85e) [![Learn about superset with Dosu](https://img.shields.io/badge/Learn%20about%20superset%20with%20Dosu-2f7b3f?style=flat&logo=data%3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zLjU0NTMgNzIuNjI2IC02LjU3OTE5IDQ3LjgwMTMgLTYuNTc5MTlWNy42MTUzMlpNNDIuNTgwNSA3LjYxNTMySDQ3LjgwMTNWLTYuNTc5MTlINDIuNTgwNVY3LjYxNTMyWk00MC43MDQgNy42MTUzMkg0Mi41ODA1Vi02LjU3OTE5SDQwLjcwNFY3LjYxNTMyWiIgZmlsbD0iYmxhY2siIG1hc2s9InVybCgjZG9zdS1kLWN1dG91dCkiLz48cGF0aCBkPSJNNjguOTIxNSAzNi4wMTM1QzY4LjkyMTUgMzYuMDEzNSA2NS43MzY5IDQ5LjQ3MzggNTEuNDIzMSA0OS40NzM4QzM3LjEwOTMgNDkuNDczOCAzMi41Nzg3IDM3LjM1OTYgMzIuNTc4NyAzNi4wMTM1IiBzdHJva2U9ImJsYWNr
 IiBzdHJva2Utd2lkdGg9IjcuNjkxNjEiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPjxwYXRoIGQ9Ik0wLjM0ODYzMyA4NS40OTQ2QzAuMzQ4NjMzIDg1LjQ5NDYgMjkuNDg1NiA4NS44MzA5IDM0LjgwOSA4NS42OThDNDQuODMzNyA4NS40NDc3IDUxLjI4NzIgODQuNDAyIDU3LjUyNjkgNzguOTcyNEM2Mi44MTI5IDc0LjM3MjcgNzUuMTM0MiA1OS42ODM2IDc1LjEzNDIgNTkuNjgzNiIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSI2LjE2NDgyIi8%2BPC9zdmc%2B)](https://github.dosu.com/apache/superset?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-learn-repo&utm_term=apache%2Fsuperset) [![Add Dosu to your team](https://img.shields.io/badge/Add%20Dosu%20to%20your%20team-1f6feb?style=flat)](https://app.dosu.dev/signup?referrer=openSource&source=github-footer&utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-add-team&utm_term=apache%2Fsuperset)


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] Cross-filter on a horizontal bar chart (no dimensions) emits the metric value instead of the x-axis category [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas closed issue #41102: Cross-filter on a horizontal bar chart (no dimensions) emits the metric value instead of the x-axis category
URL: https://github.com/apache/superset/issues/41102


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org