I am using MDRotatingPieChart in my app and created a pie chart. I need space between the slices of pie chart. Can someone help me with this?
Asked
Active
Viewed 3,439 times
2
-
You can create demo project and provide downloadable URL here from dropbox or drive, so anyone can look into it and provide you solution. – Hasya May 10 '16 at 13:00
3 Answers
2
Set slice space to piechart dataset
var pieChartView: PieChartView!
let pieChartDataSet = PieChartDataSet(yVals:yourdataentries, label: "Units Sold")
pieChartDataSet.sliceSpace = 5
let pieChartData = PieChartData(xVals:yourdatapoints, dataSet: pieChartDataSet)
pieChartView.data = pieChartData

Phani Sai
- 1,215
- 19
- 33
0
I have gone through MDRotatingPieChart, they have developed very good, but unfortunately there is no provision to put space between slices.
Below are some option for solution.
(1) Put extra slice with value, color and label as "".
Data(myValue: 10.0, myColor: UIColor(red: 1.0, green: 1.0, blue: 1.0, alpha: 1), myLabel:""),
(2) Use other libraries like - https://github.com/danielgindi/Charts
https://github.com/danielgindi/Charts/issues/104
You can download working example

Hasya
- 9,792
- 4
- 31
- 46
-
Thanks for your help. Well i have tried this code. This create space between slices. let slice = createSlice(currentStartAngle - 0.015, end: CGFloat(currentStartAngle - currentAngle) + 0.015, color:currentColor, label:currentLabel, value:currentValue, percent:100 * currentValue/total) – IOS developer May 13 '16 at 07:14
-
Is that helped you? then you could accept an answer. let me if you are still stuck in charts. – Hasya May 13 '16 at 07:16