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

Cubic lines and high slope #57

Closed
kayoslab opened this issue Nov 5, 2015 · 3 comments
Closed

Cubic lines and high slope #57

kayoslab opened this issue Nov 5, 2015 · 3 comments

Comments

@kayoslab
Copy link

kayoslab commented Nov 5, 2015

Using cubic lines and Data with a high slope after period of axial values causes a short decrease of the functions Graph. The following data example should not result in values below 0.0 :

data = [(name: "", quantity: 0.0), (name: "12:00", quantity: 0.0), (name: "", quantity: 0.0), (name: "", quantity: 60.0), (name: "", quantity: 57.0), (name: "", quantity: 50.0), (name: "", quantity: 150.0), (name: "18:00", quantity: 135.0), (name: "", quantity: 125.0), (name: "", quantity: 120.0), (name: "", quantity: 110.0), (name: "", quantity: 210.0), (name: "", quantity: 180.0), (name: "00:00", quantity: 165.0), (name: "", quantity: 142.0), (name: "", quantity: 120.0), (name: "", quantity: 100.0), (name: "", quantity: 80.0), (name: "", quantity: 75.0), (name: "06:00", quantity: 65.0), (name: "", quantity: 59.0), (name: "", quantity: 57.0), (name: "", quantity: 55.0), (name: "", quantity: 54.0)]

example-graph

@ivnsch
Copy link
Owner

ivnsch commented Nov 5, 2015

The current implementation of cubic lines has to be improved. In the meantime, you can pass a path generator to the line layer with a better interpolation algorithm. See issue #47 (next to last comment) for how to do this (there's also a link to a library that can be used for the algorithm). Feel free to ask if you need more help doing this.

@kayoslab
Copy link
Author

kayoslab commented Nov 5, 2015

Thanks for the hint, I modified it with the catmullrom extension by andrelind/swift-catmullrom. It looks slightly better now :)

@ivnsch
Copy link
Owner

ivnsch commented Dec 16, 2015

Ok, I hope the "slightly better" was good? If not as I said the algorithm from in #47 generates a decent curve.

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

No branches or pull requests

2 participants