-
-
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
Rounding the corners of bars #1066
Comments
I have been investigated on this a few months ago. It's possible, however, we need to change how we create the bar rect. Not so hard, but some decent work is needed |
That's what I investigated before, you can try first. I am still looking for other options. in let cornerRadius: CGFloat = CGRectGetWidth(barRect) <= 5 ? 1.0 : 2.0
let bezierPath = UIBezierPath(roundedRect: barRect, byRoundingCorners: UIRectCorner.AllCorners, cornerRadii: CGSizeMake(cornerRadius, cornerRadius))
let roundedPath = bezierPath.CGPath
// if drawing the bar shadow is enabled
if (drawBarShadowEnabled)
{
barShadow.origin.x = barRect.origin.x
barShadow.origin.y = viewPortHandler.contentTop
barShadow.size.width = barRect.size.width
barShadow.size.height = viewPortHandler.contentHeight
CGContextSetFillColorWithColor(context, dataSet.barShadowColor.CGColor)
// CGContextFillRect(context, barShadow)
CGContextAddPath(context, roundedPath)
CGContextFillPath(context)
}
// Set the color for the currently drawn value. If the index is out of bounds, reuse colors.
CGContextSetFillColorWithColor(context, dataSet.colorAt(j).CGColor)
// CGContextFillRect(context, barRect)
CGContextAddPath(context, roundedPath)
CGContextFillPath(context) |
Thanks so much for the feedback! I’ll play with this. |
yeah I don't think it's a great one, especially your bars are very thin |
its not working can anyone help me to do it ? |
@liuxuan30请问下,这个在最新的版本还可以? |
Thanks for your dearness
…Sent from my iPhone
On Dec 27, 2016, at 15:30, CoderZyc ***@***.***> wrote:
@liuxuan30请问下,这个在最新的版本还可以?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@CoderZyc not merged yet. there is a PR for it. |
Hey @liuxuan30 this looks awesome, any ETA on this? |
not really. I don't think it's perfect, and not having time to investigate other options. |
@liuxuan30 no worries, there is another solution that worked out nicely #1917 |
@acegreen basically they work the same way. Just wrap up nicely. Since more people asking, I am reopening this topic |
https://github.com/life360/Charts/pull/1/files (Pull request into forked repository) ChartsOrg#3754 (Pull request into original repository) ChartsOrg#1066 (Feature request in original repository)
https://github.com/life360/Charts/pull/1/files (Pull request into forked repository) ChartsOrg#3754 (Pull request into original repository) ChartsOrg#1066 (Feature request in original repository)
Any update on this? |
It looks like this and a similar pull request - #1917 - have been dead for at least 2 years. Is it worth throwing away all the work they took? |
Is there a way to achieve the same with the slices of a piechart? |
+1 |
1 similar comment
+1 |
If #4297 was merged, you could just override the renderer. |
Not merged :/ |
Recently I have been working on a project, to which I have added a chart library and display a beautiful rounded bar chart in swift. We can achieve this functionality easily. Please check this demo. |
+1 |
when this will be merge? |
Is it still not possible to round the corners? #1066 (comment) does not work for me, since I'm using SPM |
What would be the best way to achieve this effect? I’m guessing I’ll need to modify the way Charts draws in some way.
The text was updated successfully, but these errors were encountered: