Skip to content

Commit

Permalink
Minor variable refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
danielgindi committed Jul 17, 2015
1 parent f69ec21 commit bd89f68
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
14 changes: 7 additions & 7 deletions Charts/Classes/Renderers/BarChartRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public class BarChartRenderer: ChartDataRendererBase
{
var posY = 0.0
var negY = 0.0
var y2 = 0.0
var yStart = 0.0

// if drawing the bar shadow is enabled
if (drawBarShadowEnabled)
Expand Down Expand Up @@ -199,20 +199,20 @@ public class BarChartRenderer: ChartDataRendererBase
if value >= 0.0
{
y = posY
y2 = posY + value
posY = y2
yStart = posY + value
posY = yStart
}
else
{
y = negY
y2 = negY + value
negY = y2
yStart = negY + value
negY = yStart
}

var left = x - barWidth + barSpaceHalf
var right = x + barWidth - barSpaceHalf
var top = y >= y2 ? CGFloat(y) : CGFloat(y2)
var bottom = y <= y2 ? CGFloat(y) : CGFloat(y2)
var top = y >= yStart ? CGFloat(y) : CGFloat(yStart)
var bottom = y <= yStart ? CGFloat(y) : CGFloat(yStart)

// multiply the height of the rect with the phase
top *= phaseY
Expand Down
14 changes: 7 additions & 7 deletions Charts/Classes/Renderers/HorizontalBarChartRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public class HorizontalBarChartRenderer: BarChartRenderer
{
var posY = 0.0
var negY = 0.0
var y2 = 0.0
var yStart = 0.0

// if drawing the bar shadow is enabled
if (drawBarShadowEnabled)
Expand Down Expand Up @@ -160,20 +160,20 @@ public class HorizontalBarChartRenderer: BarChartRenderer
if value >= 0.0
{
y = posY
y2 = posY + value
posY = y2
yStart = posY + value
posY = yStart
}
else
{
y = negY
y2 = negY + value
negY = y2
yStart = negY + value
negY = yStart
}

var bottom = x - barWidth + barSpaceHalf
var top = x + barWidth - barSpaceHalf
var right = y >= y2 ? CGFloat(y) : CGFloat(y2)
var left = y <= y2 ? CGFloat(y) : CGFloat(y2)
var right = y >= yStart ? CGFloat(y) : CGFloat(yStart)
var left = y <= yStart ? CGFloat(y) : CGFloat(yStart)

// multiply the height of the rect with the phase
right *= phaseY
Expand Down

0 comments on commit bd89f68

Please sign in to comment.