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

Method _getLabelSizes

src/core/core.scale.js:797–811  ·  view source on GitHub ↗

* @return {{ first: object, last: object, widest: object, highest: object, widths: Array, heights: array }} * @private

()

Source from the content-addressed store, hash-verified

795 * @private
796 */
797 _getLabelSizes() {
798 let labelSizes = this._labelSizes;
799
800 if (!labelSizes) {
801 const sampleSize = this.options.ticks.sampleSize;
802 let ticks = this.ticks;
803 if (sampleSize < ticks.length) {
804 ticks = sample(ticks, sampleSize);
805 }
806
807 this._labelSizes = labelSizes = this._computeLabelSizes(ticks, ticks.length, this.options.ticks.maxTicksLimit);
808 }
809
810 return labelSizes;
811 }
812
813 /**
814 * Returns {width, height, offset} objects for the first, last, widest, highest tick

Callers 5

fitMethod · 0.95
_tickSizeMethod · 0.95
_computeLabelItemsMethod · 0.95

Calls 2

_computeLabelSizesMethod · 0.95
sampleFunction · 0.85

Tested by

no test coverage detected