Skip to content

Commit

Permalink
Prevent endless loop caused by skipWebLineCount (Fixes #424, #425)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielgindi committed Oct 1, 2015
1 parent c276177 commit 088b10d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions Charts/Classes/Charts/RadarChartView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class RadarChartView: PieRadarChartViewBase
public var drawWeb = true

/// modulus that determines how many labels and web-lines are skipped before the next is drawn
private var _webModulus = 1
private var _skipWebLineCount = 1

/// the object reprsenting the y-axis labels
private var _yAxis: ChartYAxis!
Expand Down Expand Up @@ -248,11 +248,11 @@ public class RadarChartView: PieRadarChartViewBase
{
get
{
return _webModulus - 1
return _skipWebLineCount
}
set
{
_webModulus = max(0, newValue) + 1
_skipWebLineCount = max(0, newValue)
}
}

Expand Down
5 changes: 3 additions & 2 deletions Charts/Classes/Renderers/RadarChartRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,9 @@ public class RadarChartRenderer: LineScatterCandleRadarChartRenderer
CGContextSetStrokeColorWithColor(context, _chart.webColor.CGColor)
CGContextSetAlpha(context, _chart.webAlpha)

let modulus = _chart.skipWebLineCount
for var i = 0, xValCount = _chart.data!.xValCount; i < xValCount; i += modulus
let xIncrements = 1 + _chart.skipWebLineCount

for var i = 0, xValCount = _chart.data!.xValCount; i < xValCount; i += xIncrements
{
let p = ChartUtils.getPosition(center: center, dist: CGFloat(_chart.yRange) * factor, angle: sliceangle * CGFloat(i) + rotationangle)

Expand Down

0 comments on commit 088b10d

Please sign in to comment.