Commit fee8cd4 breaks bar chart label drawing with drawValueAboveBarEnabled when some stack entries are zero
- Dominant language
- Swift
- Stars
- 28k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Screenshot:

The problem is that the snippet
if value == 0.0 && (posY == 0.0 || negY == 0.0)
{
// Take care of the situation of a 0.0 value, which overlaps a non-zero bar
y = value
yStart = y
}
resets yStart, which causes problems: when e.g. the last entry in a particular bar stack has a value of 0.0, it will reset to yStart, causing the label to be drawn at the bottom of the stack.
(This might also cause problems with drawing bars on top of one another when an intermediate stack entry is 0.0, but I haven't checked that.)
Obviously I can fix this for myself by deleting that part of the if branch, but I was wondering what @danielgindi (author of fee8cd4) would suggest as the proper fix?
Contributor guide
Research direction
Start by locating the bar-chart drawing code containing the shown zero-value branch and reproduce a stacked bar where the final entry is zero with drawValueAboveBarEnabled enabled. Verify that zero-valued entries no longer move the label to the bottom of the stack, and check whether intermediate zero entries affect overlapping bars.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- data-visualization, mobile-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100