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 radar chart negative value rendering bug if startAtZeroEnabled is false for issue #166 #207

Merged
merged 1 commit into from
Aug 12, 2015
Merged
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
14 changes: 13 additions & 1 deletion Charts/Classes/Renderers/ChartYAxisRendererRadarChart.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,17 @@ public class ChartYAxisRendererRadarChart: ChartYAxisRenderer
}
else
{
var first = ceil(Double(yMin) / interval) * interval
var rawValue = Double(yMin) / interval
var first: Double;
// if raw value negative, we need to use floor rather than ceil
if (rawValue < 0)
{
first = floor(rawValue) * interval
}
else
{
first = ceil(Double(yMin) / interval) * interval
}

if (first == 0.0)
{ // Fix for IEEE negative zero case (Where value == -0.0, and 0.0 == -0.0)
Expand Down Expand Up @@ -132,6 +142,8 @@ public class ChartYAxisRendererRadarChart: ChartYAxisRenderer
}

_yAxis.axisMaximum = _yAxis.entries[_yAxis.entryCount - 1]
// set axisMinimum to be the minimum value.
_yAxis.axisMinimum = _yAxis.entries[0]
_yAxis.axisRange = abs(_yAxis.axisMaximum - _yAxis.axisMinimum)
}

Expand Down