I am trying for PieChart
which having dynamic datas.
On clicking each Pie
, it has to highlight and rest are in normal state.
Dynamically changing lineWidth
of CAShapeLayer
, but lineWidth
increasing from middle path.
It has to increase from bottom to top
Code:
let centerPoint = CGPoint (x: circle.bounds.width / 2, y: circle.bounds.width / 2)
let circleRadius : CGFloat = circle.bounds.width / 2 * 0.83
let circlePath = UIBezierPath(arcCenter: centerPoint, radius: circleRadius, startAngle: CGFloat(1.0 * .pi), endAngle: CGFloat(3.0 * .pi), clockwise: true)
let progressCircle = CAShapeLayer()
progressCircle.path = circlePath.cgPath
progressCircle.strokeColor = color.cgColor
progressCircle.fillColor = UIColor.clear.cgColor
if onClick == 2 {
progressCircle.lineWidth = 60
} else {
progressCircle.lineWidth = 30
}
progressCircle.strokeStart = strokeStart/PieChartConstant.maxPercent
progressCircle.lineCap = CAShapeLayerLineCap.butt
progressCircle.strokeEnd = strokeEnd/PieChartConstant.maxPercent
Query:
That increased Pie
should in same track as like previous Pies
. Kindly guide me, how to achieve this.
Referred:
Checked_this , but couldn't achieve and also dont know how to achieve this.
My Output: