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

[Swift 3.0 specific] linear line chart has additional line segments wile zooming in #1421

Closed
liuxuan30 opened this issue Sep 9, 2016 · 15 comments

Comments

@liuxuan30
Copy link
Member

So when testing line chart zooming in Swift 3.0 + Chart 2.2.5,
seeing weird thing:
buggggg

It turned out that Swift 3.0 has totally changed the API signature:
Swift 3.0 is

func strokeLineSegments(between points: [CGPoint])

while swift 2.x is like

CGContextStrokeLineSegments(context, _lineSegments, size)

@danielgindi I am not sure if we should continue using line segments, or we move to old fashion like moveTo, addLineTo.. etc.

I had a simple fix #1420, but it simply destroy _lineSegments to make sure it does not have dirty points to draw, kind of loosing the performance.

Any thoughts?

@danielgindi
Copy link
Collaborator

I didn't look at it yet, but what exactly changed? It doesn't draw line segments? Or doesn't accept size?
I think that the reason that I used it was for continuous dash effects. And paths take memory...

@liuxuan30
Copy link
Member Author

liuxuan30 commented Sep 12, 2016

it changes API implementation, strokeLineSegments used to take a 'size' parameter, while on swift 3.0, it's gone.

I see the logic that it will use 'size' to determine how many points are actually connected. However, on swift 3.0, it will just connect all the points in the array, so the logic does not work any more if array size is larger than 'size' parameter

You can see from the screenshot, while you zoom in, at right side some additional line segments are drawn.

@ac1217
Copy link

ac1217 commented Sep 14, 2016

how to use in Xcode8 with swift3.0

1 similar comment
@Xiangao2018
Copy link

how to use in Xcode8 with swift3.0

@protatos
Copy link

please show us how to use / Fix the new issues in Xcode8 - swift3

@bryanratledge
Copy link

I updated cocoapods and then did a pod update and got around 200 errors when I set it to use LEGACY swift. But if I set it to use current Swift 3 I get over 1000 errors building.

I manually started fixing the 200 errors in legacy swift but they kept generating new errors each build. It turned into hours of fixing code but there was never any end in sight. Do we have any status update or a guide to show us how to use this library with Swift3/Xcode8?

@pmairoldi
Copy link
Collaborator

Please don't hijack other issues. Open another one if anything. But to answer your question, point your podfile to the swift 3.0 branch. There is a lot of documentation on this on the cocoapods website.

@ac1217
Copy link

ac1217 commented Sep 16, 2016

try to conver to the swift2.3 and find this root Pod Project -> target Charts -> Building Setting -> Swift Compiler - Version -> Use Legacy swift Language Version set YES, I do these steps then I can run successfully!

@liuxuan30
Copy link
Member Author

hey guys, stop jamming different topics. For all swift 2.3 and 3.0 information please go to #1291.

@massdonati
Copy link

hey maybe I missed it, is the original bug of this thread fixed in the current Swift-3.0 branch? I'm still seeing those lines
img_5671

@liuxuan30
Copy link
Member Author

@maxydon please try master branch. In Chart 3.0 the code has changed, so the bug should be gone. But Swift3.0 branch had this bug. I have merged #1420 into Swift 3.0 branch, however, you should understand that, this branch is obsoleted, you should move to Chart 3.0.

@massdonati
Copy link

master sims to have 2.2.5. Where do i find 3.0?

@pmairoldi
Copy link
Collaborator

No. master is 3.0. It just isn't final yet so it is not released

@massdonati
Copy link

I see but it's giving me a lot of errors i guess it's not written in swift 3?!

@pmairoldi
Copy link
Collaborator

Charts 3.0 on master is written in Swift 3.0. Please do a git pull to fetch latest or redownload the project.

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

8 participants