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

Method _tickSize

src/core/core.scale.js:977–994  ·  view source on GitHub ↗

* @return {number} * @private

()

Source from the content-addressed store, hash-verified

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

Callers 1

determineMaxTicksFunction · 0.80

Calls 3

_getLabelSizesMethod · 0.95
isHorizontalMethod · 0.95
toRadiansFunction · 0.85

Tested by

no test coverage detected