From 8d02895d0b1c6de79c8b6b33cb455684c62ab929 Mon Sep 17 00:00:00 2001 From: Michal Kubenka Date: Tue, 19 May 2015 14:17:13 +0200 Subject: [PATCH] Allow access to setLabelsToSkip from Objective-C. --- Charts/Classes/Components/ChartXAxis.swift | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Charts/Classes/Components/ChartXAxis.swift b/Charts/Classes/Components/ChartXAxis.swift index 6885049ac3..0f6bdf379e 100644 --- a/Charts/Classes/Components/ChartXAxis.swift +++ b/Charts/Classes/Components/ChartXAxis.swift @@ -83,15 +83,18 @@ public class ChartXAxis: ChartAxisBase /// Sets the number of labels that should be skipped on the axis before the next label is drawn. /// This will disable the feature that automatically calculates an adequate space between the axis labels and set the number of labels to be skipped to the fixed number provided by this method. /// Call resetLabelsToSkip(...) to re-enable automatic calculation. - public func setLabelsToSkip(var count: Int) + public func setLabelsToSkip(count: Int) { + _isAxisModulusCustom = true; + if (count < 0) { - count = 0; + axisLabelModulus = 1; + } + else + { + axisLabelModulus = count + 1; } - - _isAxisModulusCustom = true; - axisLabelModulus = count + 1; } /// Calling this will disable a custom number of labels to be skipped (set by setLabelsToSkip(...)) while drawing the x-axis. Instead, the number of values to skip will again be calculated automatically. @@ -105,4 +108,4 @@ public class ChartXAxis: ChartAxisBase { return _isAxisModulusCustom; } -} \ No newline at end of file +}