diff --git a/MVMCoreUI/Molecules/DoughnutChart.swift b/MVMCoreUI/Molecules/DoughnutChart.swift index d58dc7c4..e6a169f1 100644 --- a/MVMCoreUI/Molecules/DoughnutChart.swift +++ b/MVMCoreUI/Molecules/DoughnutChart.swift @@ -20,9 +20,9 @@ open class DoughnutChart: View, MVMCoreUIViewConstrainingProtocol { var labelContainer = ViewConstrainingView.empty() var heightConstraint: NSLayoutConstraint? - private var sizeObject = MFStyler.sizeObjectGeneric(forCurrentDevice: 150)! + private var sizeObject = MFStyler.sizeObjectGeneric(forCurrentDevice: 100)! - var height: CGFloat = 150 { + var height: CGFloat = 100 { didSet { if height != oldValue { sizeObject = MFStyler.sizeObjectGeneric(forCurrentDevice: height)! @@ -174,14 +174,14 @@ open class DoughnutChart: View, MVMCoreUIViewConstrainingProtocol { } func updateLabelContainer() { + labelContainer.setNeedsDisplay() labelContainer.layoutIfNeeded() let radius = sizeObject.getValueBasedOnApplicationWidth()/2 - lineWidth() let labelheight = labelContainer.frame.height/2 let padding = sizeObject.getValueBasedOnApplicationWidth()/2 - sqrt(pow(radius, 2) - pow(labelheight, 2)) labelContainer.leftPin?.constant = padding - labelContainer.topPin?.constant = padding - labelContainer.setNeedsDisplay() + labelContainer.topPin?.constant = max(radius - labelheight, labelheight) } }