Merge branch 'feature/doughnutchart_from_coding' of gitlab.verizon.com:BPHV_MIPS/mvm_core_ui into feature/doughnutchart_from_coding
This commit is contained in:
commit
e326ba9a47
@ -132,17 +132,16 @@ open class DoughnutChart: View {
|
|||||||
|
|
||||||
let arcCenter = shapeLayer.position
|
let arcCenter = shapeLayer.position
|
||||||
let radius = shapeLayer.bounds.size.width / 2.0 - lineWidth()/2.0
|
let radius = shapeLayer.bounds.size.width / 2.0 - lineWidth()/2.0
|
||||||
let clockwise = true
|
|
||||||
|
|
||||||
let value: CGFloat = chartModel.percent
|
let value: CGFloat = chartModel.percent
|
||||||
let gap: CGFloat = spaceReuired() ? lineGap() : 0.0
|
let gap: CGFloat = spaceRequired() ? lineGap() : 0.0
|
||||||
let startAngle = ((prevPercent / 100.0) * 2 * .pi) - (0.5 * .pi)
|
let startAngle = ((prevPercent / 100.0) * 2 * .pi) - (0.5 * .pi)
|
||||||
let endAngle = ((value / 100.0) * 2 * .pi) + startAngle - gap
|
let endAngle = ((value / 100.0) * 2 * .pi) + startAngle - gap
|
||||||
let circlePath = UIBezierPath(arcCenter: arcCenter,
|
let circlePath = UIBezierPath(arcCenter: arcCenter,
|
||||||
radius: radius,
|
radius: radius,
|
||||||
startAngle: startAngle,
|
startAngle: startAngle,
|
||||||
endAngle: endAngle,
|
endAngle: endAngle,
|
||||||
clockwise: clockwise)
|
clockwise: true)
|
||||||
|
|
||||||
shapeLayer.path = circlePath.cgPath
|
shapeLayer.path = circlePath.cgPath
|
||||||
doughnutLayer.addSublayer(shapeLayer)
|
doughnutLayer.addSublayer(shapeLayer)
|
||||||
@ -168,7 +167,7 @@ open class DoughnutChart: View {
|
|||||||
return doughnutChartModel?.sections.count == 1 ? 0.0 : 0.05
|
return doughnutChartModel?.sections.count == 1 ? 0.0 : 0.05
|
||||||
}
|
}
|
||||||
|
|
||||||
func spaceReuired() -> Bool {
|
func spaceRequired() -> Bool {
|
||||||
return doughnutChartModel?.spaceRequired ?? true
|
return doughnutChartModel?.spaceRequired ?? true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -50,7 +50,7 @@ import Foundation
|
|||||||
centerY.isActive = true
|
centerY.isActive = true
|
||||||
|
|
||||||
colorLablesStack.leadingAnchor.constraint(equalTo: doughnutChart.trailingAnchor, constant: PaddingThree).isActive = true
|
colorLablesStack.leadingAnchor.constraint(equalTo: doughnutChart.trailingAnchor, constant: PaddingThree).isActive = true
|
||||||
colorLablesStack.backgroundColor = UIColor.clear
|
colorLablesStack.backgroundColor = .clear
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func updateView(_ size: CGFloat) {
|
open override func updateView(_ size: CGFloat) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user