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

Method _tickSize

src/core/core.scale.js:982–999  ·  view source on GitHub ↗

* @return {number} * @private

()

Source from the content-addressed store, hash-verified

980 * @private
981 */
982 _tickSize() {
983 const optionTicks = this.options.ticks;
984
985 // Calculate space needed by label in axis direction.
986 const rot = toRadians(this.labelRotation);
987 const cos = Math.abs(Math.cos(rot));
988 const sin = Math.abs(Math.sin(rot));
989
990 const labelSizes = this._getLabelSizes();
991 const padding = optionTicks.autoSkipPadding || 0;
992 const w = labelSizes ? labelSizes.widest.width + padding : 0;
993 const h = labelSizes ? labelSizes.highest.height + padding : 0;
994
995 // Calculate space needed for 1 tick in axis direction.
996 return this.isHorizontal()
997 ? h * cos > w * sin ? w / cos : h / sin
998 : h * sin < w * cos ? h / cos : w / sin;
999 }
1000
1001 /**
1002 * @return {boolean}

Callers 1

determineMaxTicksFunction · 0.80

Calls 3

_getLabelSizesMethod · 0.95
isHorizontalMethod · 0.95
toRadiansFunction · 0.85

Tested by

no test coverage detected