You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "Wardormeur (via GitHub)" <gi...@apache.org> on 2024/11/13 18:12:09 UTC
[I] Inconsistent behavior for stacked bar-chart [superset]
Wardormeur opened a new issue, #30914:
URL: https://github.com/apache/superset/issues/30914
### Bug description
Hello :)
The bug seems to present itself when using a stacked barchart and contribution mode = row.
Any slice that is below a threshold will not show, which is weird when used in coordination with contribution mode because it should always reach 100%.
This behavior seems to be inconsistent depending on ordering.
The following data is the same between the 2 screenshots, only the configuration on the left is changing.
The disappearing category is just under 3%.
We are running 4.0.1 but I didn't see anything in the changelog relating to barcharts (https://github.com/apache/superset/blob/58f9be9b85cfd34f861d232cf834c96747133a39/CHANGELOG/4.0.2.md)
If I'm wrong and this was fixed, I'll be deeply sorry for your time.
### Screenshots/recordings
<img width="1398" alt="Screenshot 2024-11-13 at 18 57 14" src="https://github.com/user-attachments/assets/cb6a7ac7-c7d2-4fb9-a760-15b26b707d72">
<img width="1389" alt="Screenshot 2024-11-13 at 18 57 44" src="https://github.com/user-attachments/assets/6f1833e1-a0d3-44c9-9da3-4e367f819a37">
### Superset version
4.0.2
### Python version
3.9
### Node version
16
### Browser
Chrome
### Additional context
_No response_
### Checklist
- [X] I have searched Superset docs and Slack and didn't find a solution to my problem.
- [X] I have searched the GitHub issue tracker and didn't find a similar bug report.
- [ ] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
--
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] Inconsistent behavior for stacked bar-chart [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas closed issue #30914: Inconsistent behavior for stacked bar-chart
URL: https://github.com/apache/superset/issues/30914
--
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] Inconsistent behavior for stacked bar-chart [superset]
Posted by "dpruess (via GitHub)" <gi...@apache.org>.
dpruess commented on issue #30914:
URL: https://github.com/apache/superset/issues/30914#issuecomment-4544511302
Hi @rusackas @sfirke, I can reproduce the issue described in this thread. It still persists in Superset 6.1 and I would like to ask you to reopen it.
As described, in a 100% stacked bar chart with Contribution Mode = Row, small segments are silently dropped from the rendering even though the underlying data is present and the percentages sum to 100%. **The bug only occurs in horizontal orientation** — with vertical bars the same chart on the same data renders correctly (see screenshots below).
**Screenshots**
Vertical (correct) — same data, same config, all segments rendered:
<img width="2559" height="1087" alt="Image" src="https://github.com/user-attachments/assets/cd044b61-ba12-4652-9b97-909393e1552f" />
Horizontal (buggy) — visible gaps, bars do not reach 100%:
<img width="2559" height="1079" alt="Image" src="https://github.com/user-attachments/assets/cb3b4bf6-8220-41e6-86b1-4d8d57e848e3" />
**Reproducible SQL Query**
```sql
-- Reproducible example for stacked bar chart + contribution mode (row) bug
-- Each category sums to 1.0 across the 8 response buckets.
WITH survey_data AS (
SELECT * FROM (VALUES
('Market_A', 'freq_1_multiple_per_week', 0.04957923259683993),
('Market_A', 'freq_2_once_per_week', 0.11473646865673656),
('Market_A', 'freq_3_every_2_weeks', 0.08411398260985987),
('Market_A', 'freq_4_once_per_month', 0.07613464543474366),
('Market_A', 'freq_5_every_2_3_months', 0.05740424340773429),
('Market_A', 'freq_6_less_often', 0.10598774638925428),
('Market_A', 'freq_7_never_but_nearby', 0.07463807633186544),
('Market_A', 'freq_8_never_no_market', 0.43740560457296596),
('Market_B', 'freq_1_multiple_per_week', 0.04741191013541650),
('Market_B', 'freq_2_once_per_week', 0.14180686001291035),
('Market_B', 'freq_3_every_2_weeks', 0.09994411030913514),
('Market_B', 'freq_4_once_per_month', 0.08712060362137433),
('Market_B', 'freq_5_every_2_3_months', 0.07750892275541255),
('Market_B', 'freq_6_less_often', 0.10841262868162947),
('Market_B', 'freq_7_never_but_nearby', 0.07689863404222866),
('Market_B', 'freq_8_never_no_market', 0.36089633044189300),
('Market_C', 'freq_1_multiple_per_week', 0.09963048973353685),
('Market_C', 'freq_2_once_per_week', 0.22469041737551800),
('Market_C', 'freq_3_every_2_weeks', 0.16380472368977445),
('Market_C', 'freq_4_once_per_month', 0.12916694024691677),
('Market_C', 'freq_5_every_2_3_months', 0.11948047832935614),
('Market_C', 'freq_6_less_often', 0.14454744216522220),
('Market_C', 'freq_7_never_but_nearby', 0.06277281650916573),
('Market_C', 'freq_8_never_no_market', 0.05590669195050987),
('Market_D', 'freq_1_multiple_per_week', 0.04386839304959836),
('Market_D', 'freq_2_once_per_week', 0.13782144517688577),
('Market_D', 'freq_3_every_2_weeks', 0.10545432513578293),
('Market_D', 'freq_4_once_per_month', 0.12258455519862200),
('Market_D', 'freq_5_every_2_3_months', 0.12576791799389650),
('Market_D', 'freq_6_less_often', 0.20418835994563772),
('Market_D', 'freq_7_never_but_nearby', 0.10411585436455739),
('Market_D', 'freq_8_never_no_market', 0.15619914913501930),
('Market_E', 'freq_1_multiple_per_week', 0.09443057881604648),
('Market_E', 'freq_2_once_per_week', 0.21576911140021532),
('Market_E', 'freq_3_every_2_weeks', 0.15327581542307758),
('Market_E', 'freq_4_once_per_month', 0.13789071873079867),
('Market_E', 'freq_5_every_2_3_months', 0.12629513383045002),
('Market_E', 'freq_6_less_often', 0.15005139139871865),
('Market_E', 'freq_7_never_but_nearby', 0.08464066799736332),
('Market_E', 'freq_8_never_no_market', 0.03764658240332997),
('Market_F', 'freq_1_multiple_per_week', 0.07123371598255984),
('Market_F', 'freq_2_once_per_week', 0.15105295755986892),
('Market_F', 'freq_3_every_2_weeks', 0.16420179955913214),
('Market_F', 'freq_4_once_per_month', 0.11539479946921805),
('Market_F', 'freq_5_every_2_3_months', 0.10186332401754646),
('Market_F', 'freq_6_less_often', 0.16414613694143945),
('Market_F', 'freq_7_never_but_nearby', 0.14727509153225507),
('Market_F', 'freq_8_never_no_market', 0.08483217493798008),
('Market_G', 'freq_1_multiple_per_week', 0.06622545665543873),
('Market_G', 'freq_2_once_per_week', 0.13863795548156643),
('Market_G', 'freq_3_every_2_weeks', 0.11297744573184368),
('Market_G', 'freq_4_once_per_month', 0.10890347312644783),
('Market_G', 'freq_5_every_2_3_months', 0.09622365080734895),
('Market_G', 'freq_6_less_often', 0.16721524557021544),
('Market_G', 'freq_7_never_but_nearby', 0.14809708304228722),
('Market_G', 'freq_8_never_no_market', 0.16171968958485172),
('Market_H', 'freq_1_multiple_per_week', 0.15035999731330770),
('Market_H', 'freq_2_once_per_week', 0.24021340746551073),
('Market_H', 'freq_3_every_2_weeks', 0.17043573402321976),
('Market_H', 'freq_4_once_per_month', 0.12247282115077646),
('Market_H', 'freq_5_every_2_3_months', 0.08966118987151522),
('Market_H', 'freq_6_less_often', 0.11961309282338696),
('Market_H', 'freq_7_never_but_nearby', 0.05120620500071224),
('Market_H', 'freq_8_never_no_market', 0.05603755235157094)
) AS t(category, response_bucket, share)
)
SELECT *
FROM survey_data
ORDER BY category, response_bucket;
```
**Chart configuration**
- Dimension: category
- Metric: AVG(share)
- Breakdowns / Series: response_bucket
- Stacked Style: Stack
- Contribution Mode: Row
- Orientation: Horizontal → bug occurs / Vertical → renders correctly
Happy to provide more details, additional screenshots, or test a patch if needed.
--
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] Inconsistent behavior for stacked bar-chart [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #30914:
URL: https://github.com/apache/superset/issues/30914#issuecomment-5039420616
Thanks for the clean repro, @dpruess, and for narrowing it to horizontal orientation specifically. That's a solid lead for whoever picks this up, might be worth a regression test around the horizontal stacked-bar rendering path to pin down where the small segments disappear. Taking a look myself...
--
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] Inconsistent behavior for stacked bar-chart [superset]
Posted by "dpruess (via GitHub)" <gi...@apache.org>.
dpruess commented on issue #30914:
URL: https://github.com/apache/superset/issues/30914#issuecomment-5115713735
@rusackas Truncate Metric switching off doesn't change the missing segments. And yes, it's always the same segment after a reload that is missing.
btw a "trick" we use interally now is to use "Truncate Y Axis" and set the max to something like 1.00001. Then all segments show up again. So the problem has something to do with 100% specifically I guess.
--
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] Inconsistent behavior for stacked bar-chart [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas closed issue #30914: Inconsistent behavior for stacked bar-chart
URL: https://github.com/apache/superset/issues/30914
--
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] Inconsistent behavior for stacked bar-chart [superset]
Posted by "luciana-ols (via GitHub)" <gi...@apache.org>.
luciana-ols commented on issue #30914:
URL: https://github.com/apache/superset/issues/30914#issuecomment-3697127726
I’m experiencing the same issue described here.
In a stacked bar chart with 100% (percentage / contribution) mode enabled, some segments are not rendered visually, even though the data exists and the percentages are correctly calculated.
In my case, this usually affects smaller segments at the top of the bar, around 10 to 20 percent. The chart shows a visible gap or notch at the top, making the bar look like it does not reach 100%. Labels for these segments may still appear, which indicates the data is present and the issue is related to rendering.
This happens inconsistently across time periods, not tied to missing data or null values. Changing sorting or reordering dimensions can sometimes make the segment appear or disappear, which reinforces that this is a visualization issue rather than a data problem.
I can reproduce this consistently using a 100% stacked bar chart with multiple categories and relatively small top segments.
--
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] Inconsistent behavior for stacked bar-chart [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #30914:
URL: https://github.com/apache/superset/issues/30914#issuecomment-2837420476
We never heard back on this, so I'll close it as non-reproducible, but I'm more than happy to reopen/revisit if we can get an example chart config with an example dataset.
--
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] Inconsistent behavior for stacked bar-chart [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #30914:
URL: https://github.com/apache/superset/issues/30914#issuecomment-5098241004
Dug into @dpruess's screenshots pixel by pixel. The missing bit isn't a partial clip, it's specific segments vanishing entirely for certain categories (some as big as 15% of the row) while every other segment in the same bar renders at the correct width. So the underlying percentages are right, this reads as a rendering bug rather than bad math in `transformProps`.
I tried reproducing with a bare echarts render using the same stack/axis config (min 0, max 1, `stack`, category axis) and couldn't get a segment to drop, so I don't think it's something obvious in how we build the chart option. Feels more like a canvas-specific edge case that'd need actual browser devtools to chase down, not something I want to guess a fix for blind.
@dpruess, is "Truncate Metric" checked in your setup? And does the same category lose its segment consistently on reload, or does it shift around between runs?
--
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] Inconsistent behavior for stacked bar-chart [superset]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #30914:
URL: https://github.com/apache/superset/issues/30914#issuecomment-2474387065
<!-- Greeting -->
Hey @Wardormeur! I'm here to help you with the issue you've encountered. I'm a bot designed to assist with bug fixes, questions, and contributions. Let's work together to resolve the issue you've come across.
<!-- Answer -->
The issue you're experiencing with the stacked bar chart in contribution mode is related to the `getOverMaxHiddenFormatter` function. This function hides values that are over a certain maximum threshold, which can cause categories with very small contributions (like those below 3%) to not be displayed if they fall below this threshold <sup>[[1]](https://github.com/apache/superset/blob/master/superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts)</sup>.
Additionally, there is a configuration option called `percentageThresholdControl` that allows you to adjust the minimum threshold in percentage points for showing labels. This might help in ensuring that smaller categories are displayed <sup>[[2]](https://github.com/apache/superset/blob/master/superset-frontend/plugins/plugin-chart-echarts/src/controls.tsx)</sup>.
Regarding the changelog for version 4.0.2, the only change related to bar charts was a fix for "Excess padding in horizontal Bar charts" <sup>[[3]](https://github.com/apache/superset/blob/master/CHANGELOG/4.0.2.md)</sup>. This does not directly address the issue you're facing, so it seems the behavior you're observing might not have been fixed in the update.
<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
--
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] Inconsistent behavior for stacked bar-chart [superset]
Posted by "sfirke (via GitHub)" <gi...@apache.org>.
sfirke commented on issue #30914:
URL: https://github.com/apache/superset/issues/30914#issuecomment-2515447595
Thanks for the bug report. I have perhaps experienced some oddities like this but not been able to replicate them. Could you create a SQL query that will generate a dataset that reproduces this?
Right now there's not enough to go on to reproduce this, but if you could mock up a query that can be run in SQL Lab and saved as a virtual dataset, someone is more likely to investigate and fix.
--
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] Inconsistent behavior for stacked bar-chart [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #30914:
URL: https://github.com/apache/superset/issues/30914#issuecomment-5127281079
Think I see it. `transformProps.ts` hard-codes `yAxisMax` to 1 for row contribution mode, applied the same way regardless of orientation (the axis just gets swapped into the x-position for horizontal bars). Contribution ratios can sum fractionally over 1.0 due to floating point, so my guess is this is an echarts clipping quirk on that swapped axis rather than anything wrong in the percentages themselves. Lines up with why bumping the max to 1.00001 fixes it, and why it only shows up in horizontal mode.
--
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