Skip to content
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

Last LineChart y-label not being rendered #1585

Closed
ryanschneider opened this issue Sep 30, 2016 · 2 comments
Closed

Last LineChart y-label not being rendered #1585

ryanschneider opened this issue Sep 30, 2016 · 2 comments

Comments

@ryanschneider
Copy link

In 3.0 (using master from commit 3a2da1b) I'm seeing that the last y-label in my charts is not being rendered.

I've tracked down was I think is the cause to this line:

https://github.com/danielgindi/Charts/blob/a34d55a5c9d16c1f4f6f48f2148b4e88902c55d0/Source/Charts/Renderers/LineChartRenderer.swift#L552

I think the stride(from:to:by) should be a stride(from:through:by) (use through, not to), like so:

    open override func drawValues(context: CGContext)
    {
                //....
                for j in stride(from: _xBounds.min, through: Int(ceil(Double(_xBounds.max - _xBounds.min) * phaseX + Double(_xBounds.min))), by: 1)
                {
                    guard let e = dataSet.entryForIndex(j) else { break }

This edit works locally for me, I'll send a PR for the change as well here in a minute, but haven't done an extensive audit for the other chart types to see if a similar issue exists there.

ryanschneider added a commit to ryanschneider/Charts that referenced this issue Sep 30, 2016
)

The wrong stride termination was causing us to not render the last text value.
Verified the issue in the `ChartsDemo` example, but have not looked closely
at other chart types.
@liuxuan30
Copy link
Member

liuxuan30 commented Sep 30, 2016

This is dup to #1323
I also mentioned in #1323:

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 to the animation will be good. awkward...

@ryanschneider
Copy link
Author

Closing as dupe of #1323.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants