Skip to content

Commit

Permalink
Finish rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
Chinh Tran committed Jan 23, 2018
1 parent c7e8523 commit 417379a
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 22 deletions.
8 changes: 2 additions & 6 deletions Source/Charts/Renderers/BarChartRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ open class BarChartRenderer: BarLineScatterCandleBubbleRenderer
{
guard let dataSet = dataSets[dataSetIndex] as? IBarChartDataSet else { continue }

let angleRadians = dataSet.valueRotationAngle * ChartUtils.Math.FDEG2RAD
let angleRadians = dataSet.valueRotationAngle.DEG2RAD

if !shouldDrawValues(forDataSet: dataSet)
{
Expand Down Expand Up @@ -456,10 +456,6 @@ open class BarChartRenderer: BarLineScatterCandleBubbleRenderer
y: py,
size: icon.size)
}
font: valueFont,
align: .center,
color: dataSet.valueTextColorAt(j),

}
}
else
Expand Down Expand Up @@ -625,7 +621,7 @@ open class BarChartRenderer: BarLineScatterCandleBubbleRenderer
text: value,
point: CGPoint(x: xPos, y: yPos),
align: .center,
attributes: [NSFontAttributeName: font, NSForegroundColorAttributeName: color],
attributes: [NSAttributedStringKey.font: font, NSAttributedStringKey.foregroundColor: color],
anchor: CGPoint(x: 0.5, y: 0.5),
angleRadians: angleRadians)
}
Expand Down
5 changes: 3 additions & 2 deletions Source/Charts/Renderers/BubbleChartRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@ open class BubbleChartRenderer: BarLineScatterCandleBubbleRenderer
for j in _xBounds.min..._xBounds.range + _xBounds.min
{
guard let e = dataSet.entryForIndex(j) as? BubbleChartDataEntry else { break }


let angleRadians = dataSet.valueRotationAngle.DEG2RAD
let valueTextColor = dataSet.valueTextColorAt(j).withAlphaComponent(CGFloat(alpha))

pt.x = CGFloat(e.x)
Expand Down Expand Up @@ -187,7 +188,7 @@ open class BubbleChartRenderer: BarLineScatterCandleBubbleRenderer
x: pt.x,
y: pt.y - (0.5 * lineHeight)),
align: .center,
attributes: [NSAttributedStringKey.font: valueFont, NSAttributedStringKey.foregroundColor: valueTextColor].attributes,
attributes: [NSAttributedStringKey.font: valueFont, NSAttributedStringKey.foregroundColor: valueTextColor],
anchor: CGPoint(x: 0.5, y: 0.5),
angleRadians: angleRadians)
}
Expand Down
2 changes: 1 addition & 1 deletion Source/Charts/Renderers/CandleStickChartRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ open class CandleStickChartRenderer: LineScatterCandleRadarRenderer
continue
}

let angleRadians = dataSet.valueRotationAngle * ChartUtils.Math.FDEG2RAD
let angleRadians = dataSet.valueRotationAngle.DEG2RAD
let valueFont = dataSet.valueFont

guard let formatter = dataSet.valueFormatter else { continue }
Expand Down
2 changes: 1 addition & 1 deletion Source/Charts/Renderers/HorizontalBarChartRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ open class HorizontalBarChartRenderer: BarChartRenderer
{
guard let dataSet = dataSets[dataSetIndex] as? IBarChartDataSet else { continue }

let angleRadians = dataSet.valueRotationAngle * ChartUtils.Math.FDEG2RAD
let angleRadians = dataSet.valueRotationAngle.DEG2RAD

if !shouldDrawValues(forDataSet: dataSet) || !(dataSet.isDrawIconsEnabled && dataSet.isVisible)
{
Expand Down
4 changes: 2 additions & 2 deletions Source/Charts/Renderers/LineChartRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ open class LineChartRenderer: LineRadarRenderer
}

let valueFont = dataSet.valueFont
let valueRotationAngleRadians = dataSet.valueRotationAngle * ChartUtils.Math.FDEG2RAD
let valueRotationAngleRadians = dataSet.valueRotationAngle.DEG2RAD

guard let formatter = dataSet.valueFormatter else { continue }

Expand Down Expand Up @@ -593,7 +593,7 @@ open class LineChartRenderer: LineRadarRenderer
dataSetIndex: i,
viewPortHandler: viewPortHandler),
point: valueDrawPoint,
attributes: [NSFontAttributeName: valueFont, NSForegroundColorAttributeName: dataSet.valueTextColorAt(j)],
attributes: [NSAttributedStringKey.font: valueFont, NSAttributedStringKey.foregroundColor: dataSet.valueTextColorAt(j)],
anchor: CGPoint(x: 0.5, y: 0.5),
angleRadians: valueRotationAngleRadians)
}
Expand Down
2 changes: 1 addition & 1 deletion Source/Charts/Renderers/PieChartRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ open class PieChartRenderer: DataRenderer
}

let iconsOffset = dataSet.iconsOffset
let angleRadians = dataSet.valueRotationAngle * ChartUtils.Math.FDEG2RAD
let angleRadians = dataSet.valueRotationAngle.DEG2RAD
let xValuePosition = dataSet.xValuePosition
let yValuePosition = dataSet.yValuePosition

Expand Down
2 changes: 1 addition & 1 deletion Source/Charts/Renderers/RadarChartRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ open class RadarChartRenderer: LineRadarRenderer
}

let entryCount = dataSet.entryCount
let angleRadians = dataSet.valueRotationAngle * ChartUtils.Math.FDEG2RAD
let angleRadians = dataSet.valueRotationAngle.DEG2RAD

let iconsOffset = dataSet.iconsOffset

Expand Down
4 changes: 2 additions & 2 deletions Source/Charts/Renderers/ScatterChartRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ open class ScatterChartRenderer: LineScatterCandleRadarRenderer
continue
}

let angleRadians = dataSet.valueRotationAngle * ChartUtils.Math.FDEG2RAD
let angleRadians = dataSet.valueRotationAngle.DEG2RAD
let valueFont = dataSet.valueFont

guard let formatter = dataSet.valueFormatter else { continue }
Expand Down Expand Up @@ -194,7 +194,7 @@ open class ScatterChartRenderer: LineScatterCandleRadarRenderer
x: pt.x,
y: pt.y - shapeSize - lineHeight),
align: .center,
attributes: [NSFontAttributeName: valueFont, NSForegroundColorAttributeName: dataSet.valueTextColorAt(j)],
attributes: [NSAttributedStringKey.font: valueFont, NSAttributedStringKey.foregroundColor: dataSet.valueTextColorAt(j)],
anchor: CGPoint(x: 0.5, y:0.5),
angleRadians: angleRadians
)
Expand Down
12 changes: 6 additions & 6 deletions Source/Charts/Utils/ChartUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ open class ChartUtils
internal class func getPosition(center: CGPoint, dist: CGFloat, angle: CGFloat) -> CGPoint
{
return CGPoint(
x: center.x + dist * cos(angle * Math.FDEG2RAD),
y: center.y + dist * sin(angle * Math.FDEG2RAD)
x: center.x + dist * cos(angle.DEG2RAD),
y: center.y + dist * sin(angle.DEG2RAD)
)
}

Expand All @@ -167,11 +167,11 @@ open class ChartUtils

if align == .center
{
point.x -= text.size(attributes: attributes).width / 2.0
point.x -= text.size(withAttributes: attributes).width / 2.0
}
else if align == .right
{
point.x -= text.size(attributes: attributes).width
point.x -= text.size(withAttributes: attributes).width
}

if angleRadians == 0.0
Expand Down Expand Up @@ -246,11 +246,11 @@ open class ChartUtils

if align == .center
{
point.x -= text.size(attributes: attributes).width / 2.0
point.x -= text.size(withAttributes: attributes).width / 2.0
}
else if align == .right
{
point.x -= text.size(attributes: attributes).width
point.x -= text.size(withAttributes: attributes).width
}
return point
}
Expand Down

0 comments on commit 417379a

Please sign in to comment.