diff --git a/Source/Charts/Charts/ChartViewBase.swift b/Source/Charts/Charts/ChartViewBase.swift index c453aced0c..0fccebc4d2 100644 --- a/Source/Charts/Charts/ChartViewBase.swift +++ b/Source/Charts/Charts/ChartViewBase.swift @@ -828,7 +828,7 @@ open class ChartViewBase: NSUIView, ChartDataProvider, AnimatorDelegate /// - Returns: The bitmap that represents the chart. @objc open func getChartImage(transparent: Bool) -> NSUIImage? { - NSUIGraphicsBeginImageContextWithOptions(bounds.size, isOpaque || !transparent, NSUIMainScreen()?.nsuiScale ?? 1.0) + NSUIGraphicsBeginImageContextWithOptions(bounds.size, isOpaque || !transparent, NSUIScreen.nsuiMain?.nsuiScale ?? 1.0) guard let context = NSUIGraphicsGetCurrentContext() else { return nil } diff --git a/Source/Charts/Renderers/PieChartRenderer.swift b/Source/Charts/Renderers/PieChartRenderer.swift index 0985a3da8d..19ea0d4607 100644 --- a/Source/Charts/Renderers/PieChartRenderer.swift +++ b/Source/Charts/Renderers/PieChartRenderer.swift @@ -306,8 +306,8 @@ open class PieChartRenderer: DataRenderer // get whole the radius let radius = chart.radius let rotationAngle = chart.rotationAngle - var drawAngles = chart.drawAngles - var absoluteAngles = chart.absoluteAngles + let drawAngles = chart.drawAngles + let absoluteAngles = chart.absoluteAngles let phaseX = animator.phaseX let phaseY = animator.phaseY @@ -321,14 +321,12 @@ open class PieChartRenderer: DataRenderer let labelRadius = radius - labelRadiusOffset - var dataSets = data.dataSets + let dataSets = data.dataSets let yValueSum = (data as! PieChartData).yValueSum let drawEntryLabels = chart.isDrawEntryLabelsEnabled let usePercentValuesEnabled = chart.usePercentValuesEnabled - let entryLabelColor = chart.entryLabelColor - let entryLabelFont = chart.entryLabelFont var angle: CGFloat = 0.0 var xIndex = 0 @@ -353,7 +351,7 @@ open class PieChartRenderer: DataRenderer let yValuePosition = dataSet.yValuePosition let valueFont = dataSet.valueFont - let entryLabelFont = dataSet.entryLabelFont + let entryLabelFont = dataSet.entryLabelFont ?? chart.entryLabelFont let lineHeight = valueFont.lineHeight guard let formatter = dataSet.valueFormatter else { continue } @@ -399,7 +397,7 @@ open class PieChartRenderer: DataRenderer let drawYInside = drawValues && yValuePosition == .insideSlice let valueTextColor = dataSet.valueTextColorAt(j) - let entryLabelColor = dataSet.entryLabelColor + let entryLabelColor = dataSet.entryLabelColor ?? chart.entryLabelColor if drawXOutside || drawYOutside { diff --git a/Source/Charts/Renderers/XAxisRendererHorizontalBarChart.swift b/Source/Charts/Renderers/XAxisRendererHorizontalBarChart.swift index ce777746a0..86c569d9df 100644 --- a/Source/Charts/Renderers/XAxisRendererHorizontalBarChart.swift +++ b/Source/Charts/Renderers/XAxisRendererHorizontalBarChart.swift @@ -251,7 +251,7 @@ open class XAxisRendererHorizontalBarChart: XAxisRenderer let transformer = self.transformer else { return } - var limitLines = xAxis.limitLines + let limitLines = xAxis.limitLines if limitLines.count == 0 { diff --git a/Source/Charts/Renderers/YAxisRenderer.swift b/Source/Charts/Renderers/YAxisRenderer.swift index 80b492d5ee..9d0017f494 100644 --- a/Source/Charts/Renderers/YAxisRenderer.swift +++ b/Source/Charts/Renderers/YAxisRenderer.swift @@ -287,7 +287,7 @@ open class YAxisRenderer: AxisRendererBase let transformer = self.transformer else { return } - var limitLines = yAxis.limitLines + let limitLines = yAxis.limitLines if limitLines.count == 0 { diff --git a/Source/Charts/Renderers/YAxisRendererHorizontalBarChart.swift b/Source/Charts/Renderers/YAxisRendererHorizontalBarChart.swift index aaf0cd2553..de4f65e522 100644 --- a/Source/Charts/Renderers/YAxisRendererHorizontalBarChart.swift +++ b/Source/Charts/Renderers/YAxisRendererHorizontalBarChart.swift @@ -259,7 +259,7 @@ open class YAxisRendererHorizontalBarChart: YAxisRenderer let transformer = self.transformer else { return } - var limitLines = yAxis.limitLines + let limitLines = yAxis.limitLines if limitLines.count <= 0 { diff --git a/Source/Charts/Utils/Platform.swift b/Source/Charts/Utils/Platform.swift index 19fdbf7eec..3722647d3d 100644 --- a/Source/Charts/Utils/Platform.swift +++ b/Source/Charts/Utils/Platform.swift @@ -39,11 +39,6 @@ extension UIScreen } } -func NSUIMainScreen() -> NSUIScreen? -{ - return NSUIScreen.main -} - #endif #if os(OSX) @@ -237,9 +232,9 @@ extension NSScrollView } } -func NSUIMainScreen() -> NSUIScreen? +#endif + +extension NSUIScreen { - return NSUIScreen.main + class var nsuiMain: NSUIScreen? { .main } } - -#endif