Skip to content

Commit

Permalink
keep barRect calculation untouched
Browse files Browse the repository at this point in the history
try to simply the calculation. keep barRect calculation untouched
  • Loading branch information
liuxuan30 authored Sep 29, 2018
1 parent a77a358 commit b67c251
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Source/Charts/Renderers/BarChartRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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
}
Expand Down

0 comments on commit b67c251

Please sign in to comment.