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

Method buildTicks

src/scales/scale.category.js:97–114  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

95 }
96
97 buildTicks() {
98 const min = this.min;
99 const max = this.max;
100 const offset = this.options.offset;
101 const ticks = [];
102 let labels = this.getLabels();
103
104 // If we are viewing some subset of labels, slice the original array
105 labels = (min === 0 && max === labels.length - 1) ? labels : labels.slice(min, max + 1);
106
107 this._valueRange = Math.max(labels.length - (offset ? 0 : 1), 1);
108 this._startValue = this.min - (offset ? 0.5 : 0);
109
110 for (let value = min; value <= max; value++) {
111 ticks.push({value});
112 }
113 return ticks;
114 }
115
116 getLabelForValue(value) {
117 return _getLabelForValue.call(this, value);

Callers

nothing calls this directly

Calls 1

getLabelsMethod · 0.65

Tested by

no test coverage detected