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

Method getLabel

src/scale/Interval.ts:316–339  ·  view source on GitHub ↗
(
        tick: ScaleTick,
        opt?: IntervalScaleGetLabelOpt
    )

Source from the content-addressed store, hash-verified

314 }
315
316 getLabel(
317 tick: ScaleTick,
318 opt?: IntervalScaleGetLabelOpt
319 ): string {
320 if (tick == null) {
321 return '';
322 }
323
324 let precision = opt && opt.precision;
325
326 if (precision == null) {
327 precision = getPrecision(tick.value) || 0;
328 }
329 else if (precision === 'auto') {
330 // Should be more precise then tick.
331 precision = this._cfg.intervalPrecision;
332 }
333
334 // (1) If `precision` is set, 12.005 should be display as '12.00500'.
335 // (2) Use `round` (toFixed) to avoid scientific notation like '3.5e-7'.
336 const dataNum = round(tick.value, precision as number, true);
337
338 return addCommas(dataNum);
339 }
340
341}
342

Callers

nothing calls this directly

Calls 3

getPrecisionFunction · 0.90
roundFunction · 0.90
addCommasFunction · 0.90

Tested by

no test coverage detected