From b67c25121c7ed6a8ad524b7f19f0ab05481a74b0 Mon Sep 17 00:00:00 2001 From: Xuan Date: Sat, 29 Sep 2018 10:56:32 +0800 Subject: [PATCH] keep barRect calculation untouched try to simply the calculation. keep barRect calculation untouched --- Source/Charts/Renderers/BarChartRenderer.swift | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Source/Charts/Renderers/BarChartRenderer.swift b/Source/Charts/Renderers/BarChartRenderer.swift index 5ba6ac43da..c6eaaa21d5 100644 --- a/Source/Charts/Renderers/BarChartRenderer.swift +++ b/Source/Charts/Renderers/BarChartRenderer.swift @@ -151,12 +151,16 @@ open class BarChartRenderer: BarLineScatterCandleBubbleRenderer var top = isInverted ? (y <= 0.0 ? CGFloat(y) : 0) : (y >= 0.0 ? CGFloat(y) : 0) + top += originYOffset + var bottom = isInverted ? (y >= 0.0 ? CGFloat(y) : 0) : (y <= 0.0 ? CGFloat(y) : 0) + bottom += heightOffset // multiply the height of the rect with the phase - if top > 0 + // explicitly add 0 + originYOffset to indicate this is changed after adding accessibility support (#3650, #3520) + if top > 0 + originYOffset { top *= CGFloat(phaseY) } @@ -166,9 +170,9 @@ open class BarChartRenderer: BarLineScatterCandleBubbleRenderer } barRect.origin.x = left - barRect.origin.y = top + originYOffset + barRect.origin.y = top barRect.size.width = right - left - barRect.size.height = bottom - top + heightOffset - originYOffset + barRect.size.height = bottom - top buffer.rects[bufferIndex] = barRect bufferIndex += 1 }