MCPcopy Create free account
hub / github.com/chartjs/Chart.js / _getLabelSizes

Method _getLabelSizes

src/core/core.scale.js:802–816  ·  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

800 * @private
801 */
802 _getLabelSizes() {
803 let labelSizes = this._labelSizes;
804
805 if (!labelSizes) {
806 const sampleSize = this.options.ticks.sampleSize;
807 let ticks = this.ticks;
808 if (sampleSize < ticks.length) {
809 ticks = sample(ticks, sampleSize);
810 }
811
812 this._labelSizes = labelSizes = this._computeLabelSizes(ticks, ticks.length, this.options.ticks.maxTicksLimit);
813 }
814
815 return labelSizes;
816 }
817
818 /**
819 * 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