Fix small stacked bar rendering adding unwanted fallback color - #2056
Open
BugsBuggy wants to merge 6 commits into
Open
Fix small stacked bar rendering adding unwanted fallback color#2056BugsBuggy wants to merge 6 commits into
BugsBuggy wants to merge 6 commits into
Conversation
Author
|
@imaNNeo will you have a look? :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When using BarChartRodData with rodStackItems and small values, fl_chart automatically pads the bar to an unknown minimum height using the fallback color:
fl_chart/lib/src/chart/bar_chart/bar_chart_data.dart
Line 346 in 17afdfb
property instead of extending the stack items. This happens when a larger range toY values is present. This results in unwanted colored padding that doesn't represent actual data, making it impossible to create properly styled bars (e.g. with rounded edges) for small values without visual artifacts.
The issue occurs because fl_chart appears to enforce a minimum bar height for rendering/interaction purposes, but when the combined height of rodStackItems is less than this minimum, it fills the remaining space with the color property rather than allowing the stack items to handle the entire bar styling.
Expected behaviour: Showing small bars
Screenshots

I have overriden the default colour (cyan) with red so that the issue is visible. There should be no red proportion in the stacked chart:
Versions
The bug can be reproduced with this piece of code: