Skip to content

Commit

Permalink
fix code style in ChartYAxisRenderer
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxuan30 committed Jan 13, 2016
1 parent 4f308f7 commit 60abe34
Showing 1 changed file with 29 additions and 29 deletions.
58 changes: 29 additions & 29 deletions Charts/Classes/Renderers/ChartYAxisRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -107,41 +107,41 @@ public class ChartYAxisRenderer: ChartAxisRendererBase
{
// no forced count

// if the labels should only show min and max
if (_yAxis.isShowOnlyMinMaxEnabled)
{
_yAxis.entries = [yMin, yMax]
}
else
{
let first = ceil(Double(yMin) / interval) * interval
let last = ChartUtils.nextUp(floor(Double(yMax) / interval) * interval)

var f: Double
var i: Int
var n = 0
for (f = first; f <= last; f += interval)
// if the labels should only show min and max
if (_yAxis.isShowOnlyMinMaxEnabled)
{
++n
_yAxis.entries = [yMin, yMax]
}

if (_yAxis.entries.count < n)
{
// Ensure stops contains at least numStops elements.
_yAxis.entries = [Double](count: n, repeatedValue: 0.0)
}
else if (_yAxis.entries.count > n)
{
_yAxis.entries.removeRange(n..<_yAxis.entries.count)
}

for (f = first, i = 0; i < n; f += interval, ++i)
else
{
_yAxis.entries[i] = Double(f)
let first = ceil(Double(yMin) / interval) * interval
let last = ChartUtils.nextUp(floor(Double(yMax) / interval) * interval)

var f: Double
var i: Int
var n = 0
for (f = first; f <= last; f += interval)
{
++n
}

if (_yAxis.entries.count < n)
{
// Ensure stops contains at least numStops elements.
_yAxis.entries = [Double](count: n, repeatedValue: 0.0)
}
else if (_yAxis.entries.count > n)
{
_yAxis.entries.removeRange(n..<_yAxis.entries.count)
}

for (f = first, i = 0; i < n; f += interval, ++i)
{
_yAxis.entries[i] = Double(f)
}
}
}
}
}

/// draws the y-axis labels to the screen
public override func renderAxisLabels(context context: CGContext)
Expand Down

0 comments on commit 60abe34

Please sign in to comment.