MCPcopy
hub / github.com/chartjs/Chart.js / _tickFormatFunction

Method _tickFormatFunction

src/scales/scale.time.js:527–544  ·  view source on GitHub ↗

* Function to format an individual tick mark * @param {number} time * @param {number} index * @param {object[]} ticks * @param {string|undefined} [format] * @return {string} * @private

(time, index, ticks, format)

Source from the content-addressed store, hash-verified

525 * @private
526 */
527 _tickFormatFunction(time, index, ticks, format) {
528 const options = this.options;
529 const formatter = options.ticks.callback;
530
531 if (formatter) {
532 return call(formatter, [time, index, ticks], this);
533 }
534
535 const formats = options.time.displayFormats;
536 const unit = this._unit;
537 const majorUnit = this._majorUnit;
538 const minorFormat = unit && formats[unit];
539 const majorFormat = majorUnit && formats[majorUnit];
540 const tick = ticks[index];
541 const major = majorUnit && majorFormat && tick && tick.major;
542
543 return this._adapter.format(time, format || (major ? majorFormat : minorFormat));
544 }
545
546 /**
547 * @param {object[]} ticks

Callers 2

generateTickLabelsMethod · 0.95
_getLabelCapacityMethod · 0.95

Calls 1

formatMethod · 0.65

Tested by

no test coverage detected