(cfg: IntervalScaleConfig)
| 146 | } |
| 147 | |
| 148 | setConfig(cfg: IntervalScaleConfig): void { |
| 149 | const extent = getScaleExtentForTickUnsafe(this); |
| 150 | |
| 151 | if (__DEV__) { |
| 152 | assert(cfg.interval != null); |
| 153 | if (cfg.intervalCount != null) { |
| 154 | assert( |
| 155 | cfg.intervalCount >= -1 |
| 156 | && cfg.intervalPrecision != null |
| 157 | // Do not support intervalCount on axis break currently. |
| 158 | && !hasBreaks(this) |
| 159 | ); |
| 160 | } |
| 161 | if (cfg.niceExtent != null) { |
| 162 | assert(isFinite(cfg.niceExtent[0]) && isFinite(cfg.niceExtent[1])); |
| 163 | assert(extent[0] <= cfg.niceExtent[0] && cfg.niceExtent[1] <= extent[1]); |
| 164 | assert(round(cfg.niceExtent[0] - cfg.niceExtent[1], getPrecision(cfg.interval)) <= cfg.interval); |
| 165 | } |
| 166 | } |
| 167 | |
| 168 | // Reset all. |
| 169 | this._cfg = cfg = clone(cfg) as IntervalScaleConfigParsed; |
| 170 | if (cfg.niceExtent == null) { |
| 171 | // Dropped the auto calculated niceExtent and use user-set extent. |
| 172 | // We assume users want to set both interval and extent to get a better result. |
| 173 | cfg.niceExtent = extent.slice() as [number, number]; |
| 174 | } |
| 175 | if (cfg.intervalPrecision == null) { |
| 176 | cfg.intervalPrecision = getIntervalPrecision(cfg.interval); |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | /** |
| 181 | * In ascending order. |
no test coverage detected