Skip to content

Commit 526a73a

Browse files
committed
Fix the mess caused by the setting the min&min value of the y-axis by error
1 parent 6cbecb8 commit 526a73a

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

Source/Charts/Components/YAxis.swift

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,19 @@ open class YAxis: AxisBase
150150
var min = _customAxisMin ? _axisMinimum : dataMin
151151
var max = _customAxisMax ? _axisMaximum : dataMax
152152

153-
min = max < min ? max : min
154-
max = min > max ? min : max
153+
if min > max {
154+
if _customAxisMax && _customAxisMin {
155+
//both max and min are manullay setted
156+
min = max < min ? max : min
157+
max = min > max ? min : max
158+
} else if _customAxisMax && !_customAxisMin {
159+
min = max - 1
160+
} else if !_customAxisMax && _customAxisMin {
161+
max = min + 1
162+
}
163+
}
164+
165+
155166

156167
// temporary range (before calculations)
157168
let range = abs(max - min)

0 commit comments

Comments
 (0)