-
Notifications
You must be signed in to change notification settings - Fork 12
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
Single values not showing Swift 3 #1
Comments
I will be looking for it today and let you know 👍 |
I had the same problem, you just need to add a condition in the RKPieChartView class in the function calculateAngles(), "if item.endAngle! > 2 * π && items.count! = 1" , I leave the complete code of the function.
I hope help you |
My way, not sure about this:
|
If you have only one item, and you want It's occupy whole graph (100%), like this: private func calculateAngles() {
totalRatio = items.map({ $0.ratio }).reduce(0, { $0 + $1 })
for (index, item) in items.enumerated() {
item.startAngle = index == 0 ? 3 * π / 2 : items[index - 1].endAngle
if items.count == 1 {
items[0].ratio = 99.999999 // if ratio <= 100 then crashed. so just input 99.9999
totalRatio = 100
}
item.endAngle = item.startAngle! + (360 * item.ratio / totalRatio).degreesToRadians
if item.endAngle! > 2 * π {
item.endAngle = item.endAngle! - 2 * π
}
}
} But this solution is just a fake. And this is very easy way. |
I have installed RKPieChart and it works fine for 2 and 3 values with PieChart. but only one value is 100 and other two are 0, piechart not showing.
The text was updated successfully, but these errors were encountered: