sanitizeRange ensures that the range of the axis makes sense.
()
| 152 | // sanitizeRange ensures that the range of the |
| 153 | // axis makes sense. |
| 154 | func (a *Axis) sanitizeRange() { |
| 155 | if math.IsInf(a.Min, 0) { |
| 156 | a.Min = 0 |
| 157 | } |
| 158 | if math.IsInf(a.Max, 0) { |
| 159 | a.Max = 0 |
| 160 | } |
| 161 | if a.Min > a.Max { |
| 162 | a.Min, a.Max = a.Max, a.Min |
| 163 | } |
| 164 | if a.Min == a.Max { |
| 165 | a.Min-- |
| 166 | a.Max++ |
| 167 | } |
| 168 | |
| 169 | if a.AutoRescale { |
| 170 | marks := a.Tick.Marker.Ticks(a.Min, a.Max) |
| 171 | for _, t := range marks { |
| 172 | a.Min = math.Min(a.Min, t.Value) |
| 173 | a.Max = math.Max(a.Max, t.Value) |
| 174 | } |
| 175 | } |
| 176 | } |
| 177 | |
| 178 | // LinearScale an be used as the value of an Axis.Scale function to |
| 179 | // set the axis to a standard linear scale. |
no test coverage detected