IOS developer
IOS developer

Reputation: 57

How to generate space between slices of pie chart in MDRotatingPieChart?

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?

Upvotes: 2

Views: 3829

Answers (3)

set splicespace on piechartdataset

pieChartDataSet.sliceSpace = 2.5

Upvotes: 6

Phani Sai
Phani Sai

Reputation: 1233

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

Upvotes: 2

Hasya
Hasya

Reputation: 9898

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:""),

enter image description here

(2) Use other libraries like - https://github.com/danielgindi/Charts

https://github.com/danielgindi/Charts/issues/104

You can download working example

Download code

Upvotes: 0

Related Questions