Skip to content

Commit

Permalink
Merge pull request #313 from petester42/master
Browse files Browse the repository at this point in the history
Prevent pie slices from clipping when selected
  • Loading branch information
danielgindi committed Aug 27, 2015
2 parents aa8645c + 6601129 commit 239bbf8
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions Charts/Classes/Charts/PieChartView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,17 @@ public class PieChartView: PieRadarChartViewBase

var c = centerOffsets

let dataSets = data?.dataSets as? [PieChartDataSet]

let maxShift = dataSets?.reduce(0.0, combine: { shift, dataSet in
return dataSet.selectionShift > shift ? dataSet.selectionShift : shift
}) ?? 0.0

// create the circle box that will contain the pie-chart (the bounds of the pie-chart)
_circleBox.origin.x = c.x - radius
_circleBox.origin.y = c.y - radius
_circleBox.size.width = radius * 2.0
_circleBox.size.height = radius * 2.0
_circleBox.origin.x = (c.x - radius) + (maxShift / 2.0)
_circleBox.origin.y = (c.y - radius) + (maxShift / 2.0)
_circleBox.size.width = diameter - maxShift
_circleBox.size.height = diameter - maxShift
}

internal override func calcMinMax()
Expand Down

0 comments on commit 239bbf8

Please sign in to comment.