Add support for bezier curves
Is this still up for discussion?
Sure! I'm not in need of this feature, so the issue is stale until I've some free time to work on it. Maybe you would like to help? 😄
Ya definitely do you a have a plan for implementation or how you'd do it. I want a make it so it's an easy pr for you.
On Sun, Oct 9, 2016 at 12:47 PM Giampaolo Bellavite < [email protected]> wrote:
Sure! I'm not in need of this feature, so the issue is stale until I've some free time to work on it. Maybe you would like to help? 😄
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/gpbl/SwiftChart/issues/5#issuecomment-252500963, or mute the thread https://github.com/notifications/unsubscribe-auth/AGa85irFiJSGgJ4-FXmJKqPL9cOYINihks5qySixgaJpZM4C4T6F .
Yup this is my idea:
- It should be an option of the
ChartSeriesclass (can't figure out the name:curveddoesn't sound good), e.g. each series can be either a straight line or a curve - The curve must work for both area and line charts
- The curve should change color for positive/negative values (I say "should" because I have no idea how difficult it would be)
- The Chart class would implement two new
drawBezierLineanddrawBezierAreafileprivate methods
Basically, this part of the source:
if series.line {
drawLine(scaledXValues, yValues: scaledYValues, seriesIndex: index)
}
if series.area {
drawArea(scaledXValues, yValues: scaledYValues, seriesIndex: index)
}
should become something like:
if series.line {
if series.bezier {
drawBezierLine(scaledXValues, yValues: scaledYValues, seriesIndex: index)
} else {
drawLine(scaledXValues, yValues: scaledYValues, seriesIndex: index)
}
}
if series.area {
if series.bezier {
drawBezierArea(scaledXValues, yValues: scaledYValues, seriesIndex: index)
} else {
drawArea(scaledXValues, yValues: scaledYValues, seriesIndex: index)
}
}
This would be the ideal implementation. If it doesn't work, let discuss it together :)
Okay I think I got it. I'll submit a pr later, but It's still rough draft :)
Is this still up for discussion?