-
-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
text value on the last entry is missing from line chart #1323
Comments
my current work around is to add a dummy entry with same value as the last |
On what version of Charts? |
version 2.2.5, build 21, downloaded zip yesterday |
Did you try on 3.0? |
@danielgindi this is still happening on 3.0 as of 5540503 (latest code as of right now; September 28th). Run the demo. See the last data point drawn without a label: It seems |
I tried to fix it by changing for j in stride(from: _xBounds.min, to: Int(ceil(Double(_xBounds.max - _xBounds.min) * phaseX + Double(_xBounds.min))), by: 1) This did fix the missing label, however, I found a new issue that when zoomed in, the animation on x axis is not in sync: the value text will jump out first and then come with the line. Changing back to |
Sorry, didn't see this issue before opening #1585 and the #1586 PR. I'll keep my comments here, but will leave it up to you guys on if you want to close those. Anyways, what about adjusting the stride based on In pseudo-code: open override func drawValues(context: CGContext) {
///snip
let isAnimatingX = phaseX != 1.0
let through = isAnimatingX ?
Int(ceil(Double(_xBounds.max - _xBounds.min) * phaseX + Double(_xBounds.min))) - 1 :
Int(ceil(Double(_xBounds.max - _xBounds.min) * phaseX + Double(_xBounds.min)))
for j in stride(from: _xBounds.min, through: through, by: 1) {
}
///snip
} I think that resolves the issue, but some comments or rationale on the equation used to calculate the to/through value would be helpful. That equation is pretty dense so personally I'd prefer to see it broken down into separate lines or a helper function on XBounds ( |
Hmm, actually, after playing with the above code in the In both This is very easy to see if you use the "Animate XY" option in the demo app Line Chart with the above code change. I probably won't get much more time to look at it today, but my guess is there's something subtly wrong in |
I agree, it's different issue. However, I am not able to fine where the lag happens.. |
FWIW I've been using the proposed fix: for j in stride(from: _xBounds.min, to: Int(ceil(Double(_xBounds.max - _xBounds.min) * phaseX + Double(_xBounds.min))), by: 1) In our app. However, there seems to be an edge case that's not handled now, as we are getting some crashes on the next line: guard let e = dataSet.entryForIndex(j) else { break } Symbolication seem to be completely broken in iOS XCode 8, so I'm having to do this manually, but the crash looks to be because
I'm still not sure if the root cause is in |
repro: run the ios demo, show the first line chart, notice that the value (text) on the last entry is missing, although the value point is drawn.
The text was updated successfully, but these errors were encountered: