From a16e84d6df8eed894525d744f34ff6a84f95141b Mon Sep 17 00:00:00 2001 From: Daniel Cohen Gindi Date: Sat, 27 Feb 2016 22:19:40 +0200 Subject: [PATCH] Made viewport jobs public --- Charts/Charts.xcodeproj/project.pbxproj | 48 +++++++++---------- .../Classes/Charts/BarLineChartViewBase.swift | 16 +++---- Charts/Classes/Charts/ChartViewBase.swift | 12 ++++- Charts/Classes/Jobs/AnimatedMoveViewJob.swift | 6 +-- ...tedJob.swift => AnimatedViewPortJob.swift} | 12 ++--- Charts/Classes/Jobs/AnimatedZoomViewJob.swift | 6 +-- ...ewPortJob.swift => ChartViewPortJob.swift} | 8 ++-- ...veViewJob.swift => MoveChartViewJob.swift} | 8 ++-- ...omViewJob.swift => ZoomChartViewJob.swift} | 8 ++-- 9 files changed, 66 insertions(+), 58 deletions(-) rename Charts/Classes/Jobs/{AnimatedJob.swift => AnimatedViewPortJob.swift} (94%) rename Charts/Classes/Jobs/{ViewPortJob.swift => ChartViewPortJob.swift} (90%) rename Charts/Classes/Jobs/{MoveViewJob.swift => MoveChartViewJob.swift} (87%) rename Charts/Classes/Jobs/{ZoomViewJob.swift => ZoomChartViewJob.swift} (93%) diff --git a/Charts/Charts.xcodeproj/project.pbxproj b/Charts/Charts.xcodeproj/project.pbxproj index 49f5fb157d..af05e45497 100644 --- a/Charts/Charts.xcodeproj/project.pbxproj +++ b/Charts/Charts.xcodeproj/project.pbxproj @@ -88,14 +88,14 @@ 5BA8EC891A9D151C00CE82E1 /* ChartDataBaseFilter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BA8EC761A9D151C00CE82E1 /* ChartDataBaseFilter.swift */; }; 5BAAA8561BB08E1D00B20D4D /* CombinedHighlighter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BAAA8551BB08E1D00B20D4D /* CombinedHighlighter.swift */; }; 5BB6EC1D1ACC28AB006E9C25 /* ChartTransformerHorizontalBarChart.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BB6EC1C1ACC28AB006E9C25 /* ChartTransformerHorizontalBarChart.swift */; }; - 5BBBD9E11C80976300D01235 /* ZoomViewJob.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BBBD9E01C80976300D01235 /* ZoomViewJob.swift */; }; - 5BBBD9E21C80976300D01235 /* ZoomViewJob.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BBBD9E01C80976300D01235 /* ZoomViewJob.swift */; }; - 5BCAA74A1C7CAA4E00F83F3B /* ViewPortJob.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BCAA7491C7CAA4E00F83F3B /* ViewPortJob.swift */; }; - 5BCAA74B1C7CAA4E00F83F3B /* ViewPortJob.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BCAA7491C7CAA4E00F83F3B /* ViewPortJob.swift */; }; - 5BCAA74D1C7CAB4900F83F3B /* MoveViewJob.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BCAA74C1C7CAB4900F83F3B /* MoveViewJob.swift */; }; - 5BCAA74E1C7CAB4900F83F3B /* MoveViewJob.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BCAA74C1C7CAB4900F83F3B /* MoveViewJob.swift */; }; - 5BCAA7501C7CAD4C00F83F3B /* AnimatedJob.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BCAA74F1C7CAD4C00F83F3B /* AnimatedJob.swift */; }; - 5BCAA7511C7CAD4C00F83F3B /* AnimatedJob.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BCAA74F1C7CAD4C00F83F3B /* AnimatedJob.swift */; }; + 5BBBD9E11C80976300D01235 /* ZoomChartViewJob.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BBBD9E01C80976300D01235 /* ZoomChartViewJob.swift */; }; + 5BBBD9E21C80976300D01235 /* ZoomChartViewJob.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BBBD9E01C80976300D01235 /* ZoomChartViewJob.swift */; }; + 5BCAA74A1C7CAA4E00F83F3B /* ChartViewPortJob.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BCAA7491C7CAA4E00F83F3B /* ChartViewPortJob.swift */; }; + 5BCAA74B1C7CAA4E00F83F3B /* ChartViewPortJob.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BCAA7491C7CAA4E00F83F3B /* ChartViewPortJob.swift */; }; + 5BCAA74D1C7CAB4900F83F3B /* MoveChartViewJob.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BCAA74C1C7CAB4900F83F3B /* MoveChartViewJob.swift */; }; + 5BCAA74E1C7CAB4900F83F3B /* MoveChartViewJob.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BCAA74C1C7CAB4900F83F3B /* MoveChartViewJob.swift */; }; + 5BCAA7501C7CAD4C00F83F3B /* AnimatedViewPortJob.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BCAA74F1C7CAD4C00F83F3B /* AnimatedViewPortJob.swift */; }; + 5BCAA7511C7CAD4C00F83F3B /* AnimatedViewPortJob.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BCAA74F1C7CAD4C00F83F3B /* AnimatedViewPortJob.swift */; }; 5BCAA7531C7CB03900F83F3B /* AnimatedMoveViewJob.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BCAA7521C7CB03900F83F3B /* AnimatedMoveViewJob.swift */; }; 5BCAA7541C7CB03900F83F3B /* AnimatedMoveViewJob.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BCAA7521C7CB03900F83F3B /* AnimatedMoveViewJob.swift */; }; 5BCAA7561C7CB0DE00F83F3B /* AnimatedZoomViewJob.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BCAA7551C7CB0DE00F83F3B /* AnimatedZoomViewJob.swift */; }; @@ -332,10 +332,10 @@ 5BA8EC7C1A9D151C00CE82E1 /* ChartUtils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChartUtils.swift; sourceTree = ""; }; 5BAAA8551BB08E1D00B20D4D /* CombinedHighlighter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CombinedHighlighter.swift; sourceTree = ""; }; 5BB6EC1C1ACC28AB006E9C25 /* ChartTransformerHorizontalBarChart.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChartTransformerHorizontalBarChart.swift; sourceTree = ""; }; - 5BBBD9E01C80976300D01235 /* ZoomViewJob.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ZoomViewJob.swift; sourceTree = ""; }; - 5BCAA7491C7CAA4E00F83F3B /* ViewPortJob.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewPortJob.swift; sourceTree = ""; }; - 5BCAA74C1C7CAB4900F83F3B /* MoveViewJob.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MoveViewJob.swift; sourceTree = ""; }; - 5BCAA74F1C7CAD4C00F83F3B /* AnimatedJob.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnimatedJob.swift; sourceTree = ""; }; + 5BBBD9E01C80976300D01235 /* ZoomChartViewJob.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ZoomChartViewJob.swift; sourceTree = ""; }; + 5BCAA7491C7CAA4E00F83F3B /* ChartViewPortJob.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChartViewPortJob.swift; sourceTree = ""; }; + 5BCAA74C1C7CAB4900F83F3B /* MoveChartViewJob.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MoveChartViewJob.swift; sourceTree = ""; }; + 5BCAA74F1C7CAD4C00F83F3B /* AnimatedViewPortJob.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnimatedViewPortJob.swift; sourceTree = ""; }; 5BCAA7521C7CB03900F83F3B /* AnimatedMoveViewJob.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnimatedMoveViewJob.swift; sourceTree = ""; }; 5BCAA7551C7CB0DE00F83F3B /* AnimatedZoomViewJob.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnimatedZoomViewJob.swift; sourceTree = ""; }; 5BD4C5751BCDBF6C00462351 /* BarChartDataProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BarChartDataProvider.swift; sourceTree = ""; }; @@ -608,10 +608,10 @@ 5BCAA7481C7CAA0800F83F3B /* Jobs */ = { isa = PBXGroup; children = ( - 5BCAA7491C7CAA4E00F83F3B /* ViewPortJob.swift */, - 5BCAA74C1C7CAB4900F83F3B /* MoveViewJob.swift */, - 5BBBD9E01C80976300D01235 /* ZoomViewJob.swift */, - 5BCAA74F1C7CAD4C00F83F3B /* AnimatedJob.swift */, + 5BCAA7491C7CAA4E00F83F3B /* ChartViewPortJob.swift */, + 5BCAA74C1C7CAB4900F83F3B /* MoveChartViewJob.swift */, + 5BBBD9E01C80976300D01235 /* ZoomChartViewJob.swift */, + 5BCAA74F1C7CAD4C00F83F3B /* AnimatedViewPortJob.swift */, 5BCAA7521C7CB03900F83F3B /* AnimatedMoveViewJob.swift */, 5BCAA7551C7CB0DE00F83F3B /* AnimatedZoomViewJob.swift */, ); @@ -848,7 +848,7 @@ buildActionMask = 2147483647; files = ( 5B680D1F1A9D17C30026A057 /* ChartAxisBase.swift in Sources */, - 5BCAA74D1C7CAB4900F83F3B /* MoveViewJob.swift in Sources */, + 5BCAA74D1C7CAB4900F83F3B /* MoveChartViewJob.swift in Sources */, 5BAAA8561BB08E1D00B20D4D /* CombinedHighlighter.swift in Sources */, 659400BC1BF463C1004F9C27 /* CombinedChartData.swift in Sources */, 5B680D211A9D17C30026A057 /* ChartLimitLine.swift in Sources */, @@ -863,7 +863,7 @@ 5B6A548B1AA66A3D000F57C2 /* LineChartRenderer.swift in Sources */, 5B6A54821AA5DF34000F57C2 /* ChartYAxisRendererRadarChart.swift in Sources */, 659400B81BF463C1004F9C27 /* ChartDataEntry.swift in Sources */, - 5BCAA74A1C7CAA4E00F83F3B /* ViewPortJob.swift in Sources */, + 5BCAA74A1C7CAA4E00F83F3B /* ChartViewPortJob.swift in Sources */, 5BD4C5821BCDBF6C00462351 /* ScatterChartDataProvider.swift in Sources */, 5B6A54931AA66AAB000F57C2 /* CombinedChartRenderer.swift in Sources */, 659400C01BF463C1004F9C27 /* LineChartDataSet.swift in Sources */, @@ -874,7 +874,7 @@ 5B680D221A9D17C30026A057 /* ChartXAxis.swift in Sources */, 5BA8EC891A9D151C00CE82E1 /* ChartDataBaseFilter.swift in Sources */, 659400A21BF463C1004F9C27 /* BarChartDataEntry.swift in Sources */, - 5BCAA7501C7CAD4C00F83F3B /* AnimatedJob.swift in Sources */, + 5BCAA7501C7CAD4C00F83F3B /* AnimatedViewPortJob.swift in Sources */, 5B6654DB1BB0A86F00890030 /* ChartXAxisValueFormatter.swift in Sources */, 5B6A54A31AA66B7C000F57C2 /* LineChartView.swift in Sources */, 5B6A54891AA66A1A000F57C2 /* PieChartRenderer.swift in Sources */, @@ -902,7 +902,7 @@ 5BB6EC1D1ACC28AB006E9C25 /* ChartTransformerHorizontalBarChart.swift in Sources */, 5B680D271A9D17C30026A057 /* ChartColorTemplates.swift in Sources */, 659400C21BF463C1004F9C27 /* LineRadarChartDataSet.swift in Sources */, - 5BBBD9E11C80976300D01235 /* ZoomViewJob.swift in Sources */, + 5BBBD9E11C80976300D01235 /* ZoomChartViewJob.swift in Sources */, 5B6A54951AA66AC0000F57C2 /* CandleStickChartRenderer.swift in Sources */, 5B680D291A9D17C30026A057 /* ChartSelectionDetail.swift in Sources */, 659400A01BF463C1004F9C27 /* BarChartData.swift in Sources */, @@ -967,7 +967,7 @@ buildActionMask = 2147483647; files = ( 5597263C1BDABC0500E05E59 /* ChartDefaultXAxisValueFormatter.swift in Sources */, - 5BCAA74E1C7CAB4900F83F3B /* MoveViewJob.swift in Sources */, + 5BCAA74E1C7CAB4900F83F3B /* MoveChartViewJob.swift in Sources */, 5597263D1BDABC0500E05E59 /* ChartFillFormatter.swift in Sources */, 659400BD1BF463C1004F9C27 /* CombinedChartData.swift in Sources */, 5597263E1BDABC0500E05E59 /* ChartXAxisValueFormatter.swift in Sources */, @@ -982,7 +982,7 @@ 559726431BDABC0500E05E59 /* CandleChartDataProvider.swift in Sources */, 559726441BDABC0500E05E59 /* ChartDataProvider.swift in Sources */, 659400B91BF463C1004F9C27 /* ChartDataEntry.swift in Sources */, - 5BCAA74B1C7CAA4E00F83F3B /* ViewPortJob.swift in Sources */, + 5BCAA74B1C7CAA4E00F83F3B /* ChartViewPortJob.swift in Sources */, 559726451BDABC0500E05E59 /* LineChartDataProvider.swift in Sources */, 559726461BDABC0500E05E59 /* ScatterChartDataProvider.swift in Sources */, 659400C11BF463C1004F9C27 /* LineChartDataSet.swift in Sources */, @@ -993,7 +993,7 @@ A52C5C3F1BAC5D1100594CDD /* ChartAnimator.swift in Sources */, A52C5C401BAC5D1100594CDD /* ChartAnimationEasing.swift in Sources */, 659400A31BF463C1004F9C27 /* BarChartDataEntry.swift in Sources */, - 5BCAA7511C7CAD4C00F83F3B /* AnimatedJob.swift in Sources */, + 5BCAA7511C7CAD4C00F83F3B /* AnimatedViewPortJob.swift in Sources */, A52C5C411BAC5D1100594CDD /* BarChartView.swift in Sources */, A52C5C421BAC5D1100594CDD /* BarLineChartViewBase.swift in Sources */, A52C5C431BAC5D1100594CDD /* BubbleChartView.swift in Sources */, @@ -1021,7 +1021,7 @@ 65F06F951BE812210074498D /* IBarLineScatterCandleBubbleChartDataSet.swift in Sources */, A52C5C511BAC5D1100594CDD /* ChartMarker.swift in Sources */, 659400C31BF463C1004F9C27 /* LineRadarChartDataSet.swift in Sources */, - 5BBBD9E21C80976300D01235 /* ZoomViewJob.swift in Sources */, + 5BBBD9E21C80976300D01235 /* ZoomChartViewJob.swift in Sources */, A52C5C521BAC5D1100594CDD /* ChartXAxis.swift in Sources */, 5B4AC1CB1C58A2B90028D1A6 /* ChartFill.swift in Sources */, A52C5C531BAC5D1100594CDD /* ChartYAxis.swift in Sources */, diff --git a/Charts/Classes/Charts/BarLineChartViewBase.swift b/Charts/Classes/Charts/BarLineChartViewBase.swift index feb9e70513..8f2b2d1bd5 100644 --- a/Charts/Classes/Charts/BarLineChartViewBase.swift +++ b/Charts/Classes/Charts/BarLineChartViewBase.swift @@ -1049,7 +1049,7 @@ public class BarLineChartViewBase: ChartViewBase, BarLineScatterCandleBubbleChar yValue: Double, axis: ChartYAxis.AxisDependency) { - let job = ZoomViewJob(viewPortHandler: viewPortHandler, scaleX: scaleX, scaleY: scaleY, xIndex: xIndex, yValue: yValue, transformer: getTransformer(axis), axis: axis, view: self) + let job = ZoomChartViewJob(viewPortHandler: viewPortHandler, scaleX: scaleX, scaleY: scaleY, xIndex: xIndex, yValue: yValue, transformer: getTransformer(axis), axis: axis, view: self) addViewportJob(job) } @@ -1075,7 +1075,7 @@ public class BarLineChartViewBase: ChartViewBase, BarLineScatterCandleBubbleChar pt: CGPoint(x: viewPortHandler.contentLeft, y: viewPortHandler.contentTop), axis: axis) - let job = AnimatedZoomViewJob( + let job = AnimatedZoomChartViewJob( viewPortHandler: viewPortHandler, transformer: getTransformer(axis), view: self, @@ -1193,7 +1193,7 @@ public class BarLineChartViewBase: ChartViewBase, BarLineScatterCandleBubbleChar /// This also refreshes the chart by calling setNeedsDisplay(). public func moveViewToX(xIndex: CGFloat) { - let job = MoveViewJob( + let job = MoveChartViewJob( viewPortHandler: viewPortHandler, xIndex: xIndex, yValue: 0.0, @@ -1212,7 +1212,7 @@ public class BarLineChartViewBase: ChartViewBase, BarLineScatterCandleBubbleChar { let valsInView = getDeltaY(axis) / _viewPortHandler.scaleY - let job = MoveViewJob( + let job = MoveChartViewJob( viewPortHandler: viewPortHandler, xIndex: 0, yValue: yValue + Double(valsInView) / 2.0, @@ -1232,7 +1232,7 @@ public class BarLineChartViewBase: ChartViewBase, BarLineScatterCandleBubbleChar { let valsInView = getDeltaY(axis) / _viewPortHandler.scaleY - let job = MoveViewJob( + let job = MoveChartViewJob( viewPortHandler: viewPortHandler, xIndex: xIndex, yValue: yValue + Double(valsInView) / 2.0, @@ -1263,7 +1263,7 @@ public class BarLineChartViewBase: ChartViewBase, BarLineScatterCandleBubbleChar let valsInView = getDeltaY(axis) / _viewPortHandler.scaleY - let job = AnimatedMoveViewJob( + let job = AnimatedMoveChartViewJob( viewPortHandler: viewPortHandler, xIndex: xIndex, yValue: yValue + Double(valsInView) / 2.0, @@ -1326,7 +1326,7 @@ public class BarLineChartViewBase: ChartViewBase, BarLineScatterCandleBubbleChar let valsInView = getDeltaY(axis) / _viewPortHandler.scaleY let xsInView = CGFloat(xAxis.values.count) / _viewPortHandler.scaleX - let job = MoveViewJob( + let job = MoveChartViewJob( viewPortHandler: viewPortHandler, xIndex: xIndex - xsInView / 2.0, yValue: yValue + Double(valsInView) / 2.0, @@ -1357,7 +1357,7 @@ public class BarLineChartViewBase: ChartViewBase, BarLineScatterCandleBubbleChar let valsInView = getDeltaY(axis) / _viewPortHandler.scaleY let xsInView = CGFloat(xAxis.values.count) / _viewPortHandler.scaleX - let job = AnimatedMoveViewJob( + let job = AnimatedMoveChartViewJob( viewPortHandler: viewPortHandler, xIndex: xIndex - xsInView / 2.0, yValue: yValue + Double(valsInView) / 2.0, diff --git a/Charts/Classes/Charts/ChartViewBase.swift b/Charts/Classes/Charts/ChartViewBase.swift index 46e0a8a030..138be77a94 100755 --- a/Charts/Classes/Charts/ChartViewBase.swift +++ b/Charts/Classes/Charts/ChartViewBase.swift @@ -861,7 +861,7 @@ public class ChartViewBase: UIView, ChartDataProvider, ChartAnimatorDelegate } #endif - internal var _viewportJobs = [ViewPortJob]() + internal var _viewportJobs = [ChartViewPortJob]() public override func observeValueForKeyPath(keyPath: String?, ofObject object: AnyObject?, change: [String : AnyObject]?, context: UnsafeMutablePointer) { @@ -887,12 +887,20 @@ public class ChartViewBase: UIView, ChartDataProvider, ChartAnimatorDelegate } } + public func removeViewportJob(job: ChartViewPortJob) + { + if let index = _viewportJobs.indexOf({ $0 === job }) + { + _viewportJobs.removeAtIndex(index) + } + } + public func clearAllViewportJobs() { _viewportJobs.removeAll(keepCapacity: false) } - internal func addViewportJob(job: ViewPortJob) + public func addViewportJob(job: ChartViewPortJob) { if (_viewPortHandler.hasChartDimens) { diff --git a/Charts/Classes/Jobs/AnimatedMoveViewJob.swift b/Charts/Classes/Jobs/AnimatedMoveViewJob.swift index 96db598a04..da9abefe61 100644 --- a/Charts/Classes/Jobs/AnimatedMoveViewJob.swift +++ b/Charts/Classes/Jobs/AnimatedMoveViewJob.swift @@ -1,5 +1,5 @@ // -// AnimatedMoveViewJob.swift +// AnimatedMoveChartViewJob.swift // Charts // // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda @@ -11,9 +11,9 @@ import Foundation -internal class AnimatedMoveViewJob: AnimatedJob +public class AnimatedMoveChartViewJob: AnimatedViewPortJob { - internal override init( + public override init( viewPortHandler: ChartViewPortHandler, xIndex: CGFloat, yValue: Double, diff --git a/Charts/Classes/Jobs/AnimatedJob.swift b/Charts/Classes/Jobs/AnimatedViewPortJob.swift similarity index 94% rename from Charts/Classes/Jobs/AnimatedJob.swift rename to Charts/Classes/Jobs/AnimatedViewPortJob.swift index 5a903e79c9..b2995c09a0 100644 --- a/Charts/Classes/Jobs/AnimatedJob.swift +++ b/Charts/Classes/Jobs/AnimatedViewPortJob.swift @@ -1,5 +1,5 @@ // -// AnimatedJob.swift +// AnimatedViewPortJob.swift // Charts // // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda @@ -11,7 +11,7 @@ import Foundation -internal class AnimatedJob: ViewPortJob +public class AnimatedViewPortJob: ChartViewPortJob { internal var phase: CGFloat = 1.0 internal var xOrigin: CGFloat = 0.0 @@ -24,7 +24,7 @@ internal class AnimatedJob: ViewPortJob private var _easing: ChartEasingFunctionBlock? - internal init( + public init( viewPortHandler: ChartViewPortHandler, xIndex: CGFloat, yValue: Double, @@ -52,12 +52,12 @@ internal class AnimatedJob: ViewPortJob stop(finish: false) } - internal override func doJob() + public override func doJob() { start() } - private func start() + public func start() { _startTime = CACurrentMediaTime() _endTime = _startTime + _duration @@ -69,7 +69,7 @@ internal class AnimatedJob: ViewPortJob _displayLink.addToRunLoop(NSRunLoop.mainRunLoop(), forMode: NSRunLoopCommonModes) } - private func stop(finish finish: Bool) + public func stop(finish finish: Bool) { if (_displayLink != nil) { diff --git a/Charts/Classes/Jobs/AnimatedZoomViewJob.swift b/Charts/Classes/Jobs/AnimatedZoomViewJob.swift index 619a3c32b4..542c8fb453 100644 --- a/Charts/Classes/Jobs/AnimatedZoomViewJob.swift +++ b/Charts/Classes/Jobs/AnimatedZoomViewJob.swift @@ -1,5 +1,5 @@ // -// AnimatedZoomViewJob.swift +// AnimatedZoomChartViewJob.swift // Charts // // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda @@ -11,7 +11,7 @@ import Foundation -internal class AnimatedZoomViewJob: AnimatedJob +public class AnimatedZoomChartViewJob: AnimatedViewPortJob { internal var yAxis: ChartYAxis? internal var xValCount: Int = 0 @@ -22,7 +22,7 @@ internal class AnimatedZoomViewJob: AnimatedJob internal var zoomCenterX: CGFloat = 0.0 internal var zoomCenterY: CGFloat = 0.0 - internal init( + public init( viewPortHandler: ChartViewPortHandler, transformer: ChartTransformer, view: ChartViewBase, diff --git a/Charts/Classes/Jobs/ViewPortJob.swift b/Charts/Classes/Jobs/ChartViewPortJob.swift similarity index 90% rename from Charts/Classes/Jobs/ViewPortJob.swift rename to Charts/Classes/Jobs/ChartViewPortJob.swift index 94058d8e43..96e609fd95 100644 --- a/Charts/Classes/Jobs/ViewPortJob.swift +++ b/Charts/Classes/Jobs/ChartViewPortJob.swift @@ -1,5 +1,5 @@ // -// ViewPortJob.swift +// ChartViewPortJob.swift // Charts // // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda @@ -12,7 +12,7 @@ import Foundation // This defines a viewport modification job, used for delaying or animating viewport changes -internal class ViewPortJob +public class ChartViewPortJob { internal var point: CGPoint = CGPoint() internal weak var viewPortHandler: ChartViewPortHandler? @@ -21,7 +21,7 @@ internal class ViewPortJob internal weak var transformer: ChartTransformer? internal weak var view: ChartViewBase? - internal init( + public init( viewPortHandler: ChartViewPortHandler, xIndex: CGFloat, yValue: Double, @@ -35,7 +35,7 @@ internal class ViewPortJob self.view = view } - internal func doJob() + public func doJob() { // Override this } diff --git a/Charts/Classes/Jobs/MoveViewJob.swift b/Charts/Classes/Jobs/MoveChartViewJob.swift similarity index 87% rename from Charts/Classes/Jobs/MoveViewJob.swift rename to Charts/Classes/Jobs/MoveChartViewJob.swift index ec3c8e8906..3f5718a617 100644 --- a/Charts/Classes/Jobs/MoveViewJob.swift +++ b/Charts/Classes/Jobs/MoveChartViewJob.swift @@ -1,5 +1,5 @@ // -// MoveViewJob.swift +// MoveChartViewJob.swift // Charts // // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda @@ -11,9 +11,9 @@ import Foundation -internal class MoveViewJob: ViewPortJob +public class MoveChartViewJob: ChartViewPortJob { - internal override init( + public override init( viewPortHandler: ChartViewPortHandler, xIndex: CGFloat, yValue: Double, @@ -28,7 +28,7 @@ internal class MoveViewJob: ViewPortJob view: view) } - internal override func doJob() + public override func doJob() { guard let viewPortHandler = viewPortHandler, diff --git a/Charts/Classes/Jobs/ZoomViewJob.swift b/Charts/Classes/Jobs/ZoomChartViewJob.swift similarity index 93% rename from Charts/Classes/Jobs/ZoomViewJob.swift rename to Charts/Classes/Jobs/ZoomChartViewJob.swift index 5edfff34a2..db30f6d73d 100644 --- a/Charts/Classes/Jobs/ZoomViewJob.swift +++ b/Charts/Classes/Jobs/ZoomChartViewJob.swift @@ -1,5 +1,5 @@ // -// ZoomViewJob.swift +// ZoomChartViewJob.swift // Charts // // Copyright 2015 Daniel Cohen Gindi & Philipp Jahoda @@ -11,13 +11,13 @@ import Foundation -internal class ZoomViewJob: ViewPortJob +public class ZoomChartViewJob: ChartViewPortJob { internal var scaleX: CGFloat = 0.0 internal var scaleY: CGFloat = 0.0 internal var axisDependency: ChartYAxis.AxisDependency = ChartYAxis.AxisDependency.Left - internal init( + public init( viewPortHandler: ChartViewPortHandler, scaleX: CGFloat, scaleY: CGFloat, @@ -39,7 +39,7 @@ internal class ZoomViewJob: ViewPortJob self.axisDependency = axis } - internal override func doJob() + public override func doJob() { guard let viewPortHandler = viewPortHandler,