| OLD | NEW |
| 1 // | 1 // |
| 2 // Copyright 2014 Google Inc. All rights reserved. | 2 // Copyright 2014 Google Inc. All rights reserved. |
| 3 // | 3 // |
| 4 // Use of this source code is governed by a BSD-style | 4 // Use of this source code is governed by a BSD-style |
| 5 // license that can be found in the LICENSE file or at | 5 // license that can be found in the LICENSE file or at |
| 6 // https://developers.google.com/open-source/licenses/bsd | 6 // https://developers.google.com/open-source/licenses/bsd |
| 7 // | 7 // |
| 8 | 8 |
| 9 /// Collection of scales for use by charts. The role of scales is to map the | 9 /// Collection of scales for use by charts. The role of scales is to map the |
| 10 /// input domain to an output range. | 10 /// input domain to an output range. |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 void rangeRoundBands(Iterable range, [double padding, double outerPadding]); | 106 void rangeRoundBands(Iterable range, [double padding, double outerPadding]); |
| 107 } | 107 } |
| 108 | 108 |
| 109 class RoundingFunctions extends Pair<RoundFunction, RoundFunction> { | 109 class RoundingFunctions extends Pair<RoundFunction, RoundFunction> { |
| 110 RoundingFunctions(RoundFunction floor, RoundFunction ceil) | 110 RoundingFunctions(RoundFunction floor, RoundFunction ceil) |
| 111 : super(floor, ceil); | 111 : super(floor, ceil); |
| 112 | 112 |
| 113 factory RoundingFunctions.defaults() => | 113 factory RoundingFunctions.defaults() => |
| 114 new RoundingFunctions((x) => x.floor(), (x) => x.ceil()); | 114 new RoundingFunctions((x) => x.floor(), (x) => x.ceil()); |
| 115 | 115 |
| 116 factory RoundingFunctions.identity() => | 116 factory RoundingFunctions.identity() => new RoundingFunctions( |
| 117 new RoundingFunctions(identityFunction, identityFunction); | 117 (num n) => identityFunction/*<num>*/(n), |
| 118 (num n) => identityFunction/*<num>*/(n)); |
| 118 | 119 |
| 119 RoundFunction get floor => super.first; | 120 RoundFunction get floor => super.first; |
| 120 RoundFunction get ceil => super.last; | 121 RoundFunction get ceil => super.last; |
| 121 } | 122 } |
| 122 | 123 |
| 123 /// Namespacing container for utilities used by scales. | 124 /// Namespacing container for utilities used by scales. |
| 124 abstract class ScaleUtils { | 125 abstract class ScaleUtils { |
| 125 /// Utility to return extent of sorted [values]. | 126 /// Utility to return extent of sorted [values]. |
| 126 static Extent extent(Iterable values) => values.first < values.last | 127 static Extent extent(Iterable values) => values.first < values.last |
| 127 ? new Extent(values.first, values.last) | 128 ? new Extent(values.first, values.last) |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 hi = mid; | 222 hi = mid; |
| 222 } else { | 223 } else { |
| 223 lo = mid + 1; | 224 lo = mid + 1; |
| 224 } | 225 } |
| 225 } | 226 } |
| 226 return lo; | 227 return lo; |
| 227 } | 228 } |
| 228 | 229 |
| 229 static Function bisect = bisectRight; | 230 static Function bisect = bisectRight; |
| 230 } | 231 } |
| OLD | NEW |