I´m using Charts for iOS and have a pie chart. I would like to remove the inner circle and change the width for each pie inside the pie chart. I have not been able to find how to decrease the width for the pie chart and remove the inner circle.
The image is what I want to do.
I have tried on my PieChartView
to change the draw
properties but have not succeeded. Any ideas how to solve this?
PieChartView
has the following properties:
holeRadiusPercent
transparentCircleRadiusPercent
Set them both to 0.0
and you should achieve what you want.
You can also hide the hole explicitly by setting chartView.drawHoleEnabled = false
If you need more properties, just open the source code. It is heavily commented.
Adding to @sulthan's response with some example code.
The CGSize of the chart view's frame can be modified to affect the chart width itself.
However, a CGSize which exceeds the CGSize of the chart's parent view may result in unpredictable layouts.
let chart = PieChartView( frame: self.view.frame)
// setup data...etc.
// style
chart.holeRadiusPercent = 0
chart.transparentCircleColor = UIColor.clear
// increase width
// width in excess of the parentView.size.width will cause layout issues
chart.frame.size = CGSize(width: 500, height: chart.frame.size.height)
Shameless plug: Learn more about iOS Pie charts at ioscharts.io/piechart
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With