0
votes

I have created piechart with the help of following library: https://github.com/danielgindi/Charts and currently using pod 'Charts', '~> 3.0.4'.

I have created half pie chart and also setup label on it but it keeps on rotating and sometimes it's going outside the slice or overlap on another label. Please use following images for reference.

When we setup label at the first time

When we rotate the screen then it gets overlapped

Also, code for implementation:

pieChartLV1 = PieChartView();

pieChartLV1.chartDescription?.text = ""
pieChartLV1.legend.enabled = false
pieChartLV1.holeRadiusPercent = 0.3
pieChartLV1.translatesAutoresizingMaskIntoConstraints = false
pieChartLV1.transparentCircleColor = UIColor.clear
pieChartLV1.usePercentValuesEnabled = true
pieChartLV1.entryLabelColor = UIColor.black

//adding data 
 let Level1Data = ["Eligibilty": 10, "Enrollment": 10, "Benefit Design": 10, "Biology": 10, "Behaviour": 10,"Environment": 10, "Outcomes": 10, "workflow": 10, "Errors": 10, "Billings & \nPayments": 10, "Fraud & \nAbuse": 10, "Medical \nPolicy": 10]
var dataEntries = [PieChartDataEntry]()
for (key, val) in Level1Data {
      let entry = PieChartDataEntry(value: Double(val), label: key)
           entry.label = key
           dataEntries.append(entry)
     }

let chartDataSet = PieChartDataSet(values: dataEntries, label: "")
chartDataSet.colors = ChartColorTemplates.material()
chartDataSet.sliceSpace = 2
chartDataSet.selectionShift = 0
chartDataSet.valueTextColor = UIColor.black

let chartData = PieChartData(dataSet: chartDataSet)
chartData.setDrawValues(false)

pieChartLV3.data = chartData2

I want a fixed label on pie chart with some angle Or need to remove rotational animation of a label.

Thanks in advance.

1

1 Answers

0
votes

chartDataSet.rotationEnabled = false