MCPcopy
hub / github.com/apache/echarts / loopIncreaseInterval

Function loopIncreaseInterval

src/coord/axisAlignTicks.ts:193–214  ·  view source on GitHub ↗
(cb: () => boolean)

Source from the content-addressed store, hash-verified

191 let minNice: number;
192
193 function loopIncreaseInterval(cb: () => boolean) {
194 // Typically this loop runs less than 5 times. But we still
195 // use a fail-safe for future changes.
196 const LOOP_MAX = 50;
197 let loopGuard = 0;
198 for (; loopGuard < LOOP_MAX; loopGuard++) {
199 if (cb()) {
200 break;
201 }
202 interval = isTargetLogScale
203 // TODO: `mathMax(base, 2)` is a guardcode to avoid infinite loop,
204 // but probably it should be guranteed by `LogScale` itself.
205 ? interval * mathMax(targetLogScaleBase, 2)
206 : increaseInterval(interval);
207 intervalPrecision = getIntervalPrecision(interval);
208 }
209 if (__DEV__) {
210 if (loopGuard >= LOOP_MAX) {
211 warn('incorrect impl in `scaleCalcAlign`.');
212 }
213 }
214 }
215
216 function updateMinFromMinNice() {
217 min = round(minNice - interval * t0, intervalPrecision);

Callers 1

scaleCalcAlignFunction · 0.85

Calls 4

increaseIntervalFunction · 0.90
getIntervalPrecisionFunction · 0.90
warnFunction · 0.90
cbFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…