ChartsOrg / ChartsOrg/Charts

Commit fee8cd4 breaks bar chart label drawing with drawValueAboveBarEnabled when some stack entries are zero

Open
#2,468 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
28k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Screenshot:

screen shot 2017-05-24 at 12 29 26

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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.