(boxes, chartArea, params, stacks)
| 216 | } |
| 217 | |
| 218 | function placeBoxes(boxes, chartArea, params, stacks) { |
| 219 | const userPadding = params.padding; |
| 220 | let {x, y} = chartArea; |
| 221 | |
| 222 | for (const layout of boxes) { |
| 223 | const box = layout.box; |
| 224 | const stack = stacks[layout.stack] || {count: 1, placed: 0, weight: 1}; |
| 225 | const weight = (layout.stackWeight / stack.weight) || 1; |
| 226 | if (layout.horizontal) { |
| 227 | const width = chartArea.w * weight; |
| 228 | const height = stack.size || box.height; |
| 229 | if (defined(stack.start)) { |
| 230 | y = stack.start; |
| 231 | } |
| 232 | if (box.fullSize) { |
| 233 | setBoxDims(box, userPadding.left, y, params.outerWidth - userPadding.right - userPadding.left, height); |
| 234 | } else { |
| 235 | setBoxDims(box, chartArea.left + stack.placed, y, width, height); |
| 236 | } |
| 237 | stack.start = y; |
| 238 | stack.placed += width; |
| 239 | y = box.bottom; |
| 240 | } else { |
| 241 | const height = chartArea.h * weight; |
| 242 | const width = stack.size || box.width; |
| 243 | if (defined(stack.start)) { |
| 244 | x = stack.start; |
| 245 | } |
| 246 | if (box.fullSize) { |
| 247 | setBoxDims(box, x, userPadding.top, width, params.outerHeight - userPadding.bottom - userPadding.top); |
| 248 | } else { |
| 249 | setBoxDims(box, x, chartArea.top + stack.placed, width, height); |
| 250 | } |
| 251 | stack.start = x; |
| 252 | stack.placed += height; |
| 253 | x = box.right; |
| 254 | } |
| 255 | } |
| 256 | |
| 257 | chartArea.x = x; |
| 258 | chartArea.y = y; |
| 259 | } |
| 260 | |
| 261 | /** |
| 262 | * @interface LayoutItem |
no test coverage detected
searching dependent graphs…