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

Method _getRuler

src/controllers/controller.bar.js:532–557  ·  view source on GitHub ↗

* @private

()

Source from the content-addressed store, hash-verified

530 * @private
531 */
532 _getRuler() {
533 const opts = this.options;
534 const meta = this._cachedMeta;
535 const iScale = meta.iScale;
536 const pixels = [];
537 let i, ilen;
538
539 for (i = 0, ilen = meta.data.length; i < ilen; ++i) {
540 pixels.push(iScale.getPixelForValue(this.getParsed(i)[iScale.axis], i));
541 }
542
543 const barThickness = opts.barThickness;
544 const min = barThickness || computeMinSampleSize(meta);
545
546 return {
547 min,
548 pixels,
549 start: iScale._startPixel,
550 end: iScale._endPixel,
551 stackCount: this._getStackCount(),
552 scale: iScale,
553 grouped: opts.grouped,
554 // bar thickness ratio used for non-grouped bars
555 ratio: barThickness ? 1 : opts.categoryPercentage * opts.barPercentage
556 };
557 }
558
559 /**
560 * Note: pixel values are not clamped to the scale area.

Callers 1

updateElementsMethod · 0.95

Calls 4

_getStackCountMethod · 0.95
computeMinSampleSizeFunction · 0.85
getParsedMethod · 0.80
getPixelForValueMethod · 0.65

Tested by

no test coverage detected