Skip to content

Commit

Permalink
fix code indent problem in ChartYAxisRendererRadarChart, ChartYAxisRe…
Browse files Browse the repository at this point in the history
…nderer, BarChartDataSet, RadarChartView
  • Loading branch information
liuxuan30 committed Jan 18, 2016
1 parent ed5f25e commit 645f124
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 78 deletions.
4 changes: 2 additions & 2 deletions Charts/Classes/Charts/RadarChartView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ public class RadarChartView: PieRadarChartViewBase
else if minLeft >= 0.0
{
// We have positive values only, stay in the positive zone
_yAxis.axisMinimum = 0.0
_yAxis.axisMinimum = 0.0
_yAxis.axisMaximum = max(0.0, !isnan(_yAxis.customAxisMax) ? _yAxis.customAxisMax : (maxLeft + topSpaceLeft))
}
}
else
{
// Stick the minimum to 0.0 or less, and maximum to 0.0 or more (startAtZero for negative/positive at the same time)
Expand Down
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
94 changes: 47 additions & 47 deletions Charts/Classes/Renderers/ChartYAxisRendererRadarChart.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class ChartYAxisRendererRadarChart: ChartYAxisRenderer

_chart = chart
}

public override func computeAxis(yMin yMin: Double, yMax: Double)
{
computeAxisValues(min: yMin, max: yMax)
Expand Down Expand Up @@ -83,61 +83,61 @@ public class ChartYAxisRendererRadarChart: ChartYAxisRenderer
{
// no forced count

// clean old values
if (_yAxis.entries.count > 0)
{
_yAxis.entries.removeAll(keepCapacity: false)
}

// if the labels should only show min and max
if (_yAxis.isShowOnlyMinMaxEnabled)
{
_yAxis.entries = [Double]()
_yAxis.entries.append(yMin)
_yAxis.entries.append(yMax)
}
else
{
// clean old values
if (_yAxis.entries.count > 0)
{
_yAxis.entries.removeAll(keepCapacity: false)
}
// if the labels should only show min and max
if (_yAxis.isShowOnlyMinMaxEnabled)
{
_yAxis.entries = [Double]()
_yAxis.entries.append(yMin)
_yAxis.entries.append(yMax)
}
else
{
let rawCount = Double(yMin) / interval
var first = rawCount < 0.0 ? floor(rawCount) * interval : ceil(rawCount) * interval;

if (first < yMin && _yAxis.isStartAtZeroEnabled)
{ // Force the first label to be at the 0 (or smallest negative value)
first = yMin
}

if (first == 0.0)
{ // Fix for IEEE negative zero case (Where value == -0.0, and 0.0 == -0.0)
first = 0.0
}

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 (isnan(_yAxis.customAxisMax))
{
n += 1
}

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

for (f = first, i = 0; i < n; f += interval, ++i)
{
_yAxis.entries[i] = Double(f)
if (first == 0.0)
{ // Fix for IEEE negative zero case (Where value == -0.0, and 0.0 == -0.0)
first = 0.0
}

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 (isnan(_yAxis.customAxisMax))
{
n += 1
}

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

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

if !_yAxis.isStartAtZeroEnabled && _yAxis.entries[0] < yMin
{
Expand Down

0 comments on commit 645f124

Please sign in to comment.