Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix code indent problem in ChartYAxisRendererRadarChart, ChartYAxisRenderer, BarChartDataSet, RadarChartView #675

Merged
merged 1 commit into from
Jan 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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