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

Function buildLayoutBoxes

src/core/core.layouts.ts:133–151  ·  view source on GitHub ↗
(boxes: LayoutBoxItem[])

Source from the content-addressed store, hash-verified

131}
132
133function buildLayoutBoxes(boxes: LayoutBoxItem[]) {
134 const layoutBoxes = wrapBoxes(boxes);
135 const fullSize = sortByWeight(layoutBoxes.filter(wrap => wrap.box.fullSize), true);
136 const left = sortByWeight(filterByPosition(layoutBoxes, 'left'), true);
137 const right = sortByWeight(filterByPosition(layoutBoxes, 'right'));
138 const top = sortByWeight(filterByPosition(layoutBoxes, 'top'), true);
139 const bottom = sortByWeight(filterByPosition(layoutBoxes, 'bottom'));
140 const centerHorizontal = filterDynamicPositionByAxis(layoutBoxes, 'x');
141 const centerVertical = filterDynamicPositionByAxis(layoutBoxes, 'y');
142
143 return {
144 fullSize,
145 leftAndTop: left.concat(top),
146 rightAndBottom: right.concat(centerVertical).concat(bottom).concat(centerHorizontal),
147 chartArea: filterByPosition(layoutBoxes, 'chartArea'),
148 vertical: left.concat(right).concat(centerVertical),
149 horizontal: top.concat(bottom).concat(centerHorizontal)
150 };
151}
152
153function getCombinedMax(maxPadding: ChartArea, chartArea: LayoutArea, a: keyof TRBL, b: keyof TRBL) {
154 return Math.max(maxPadding[a], chartArea[a]) + Math.max(maxPadding[b], chartArea[b]);

Callers 1

updateFunction · 0.85

Calls 4

wrapBoxesFunction · 0.85
sortByWeightFunction · 0.85
filterByPositionFunction · 0.85

Tested by

no test coverage detected