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

Function setMajorTicks

src/scales/scale.time.js:156–169  ·  view source on GitHub ↗

* @param {TimeScale} scale * @param {object[]} ticks * @param {object} map * @param {Unit} majorUnit * @return {object[]}

(scale, ticks, map, majorUnit)

Source from the content-addressed store, hash-verified

154 * @return {object[]}
155 */
156function setMajorTicks(scale, ticks, map, majorUnit) {
157 const adapter = scale._adapter;
158 const first = +adapter.startOf(ticks[0].value, majorUnit);
159 const last = ticks[ticks.length - 1].value;
160 let major, index;
161
162 for (major = first; major <= last; major = +adapter.add(major, 1, majorUnit)) {
163 index = map[major];
164 if (index >= 0) {
165 ticks[index].major = true;
166 }
167 }
168 return ticks;
169}
170
171/**
172 * @param {TimeScale} scale

Callers 1

ticksFromTimestampsFunction · 0.85

Calls 2

startOfMethod · 0.65
addMethod · 0.65

Tested by

no test coverage detected