* store dimensions used instead of available chartArea in fitBoxes
(layouts, params)
| 63 | * store dimensions used instead of available chartArea in fitBoxes |
| 64 | **/ |
| 65 | function setLayoutDims(layouts, params) { |
| 66 | const stacks = buildStacks(layouts); |
| 67 | const {vBoxMaxWidth, hBoxMaxHeight} = params; |
| 68 | let i, ilen, layout; |
| 69 | for (i = 0, ilen = layouts.length; i < ilen; ++i) { |
| 70 | layout = layouts[i]; |
| 71 | const {fullSize} = layout.box; |
| 72 | const stack = stacks[layout.stack]; |
| 73 | const factor = stack && layout.stackWeight / stack.weight; |
| 74 | if (layout.horizontal) { |
| 75 | layout.width = factor ? factor * vBoxMaxWidth : fullSize && params.availableWidth; |
| 76 | layout.height = hBoxMaxHeight; |
| 77 | } else { |
| 78 | layout.width = vBoxMaxWidth; |
| 79 | layout.height = factor ? factor * hBoxMaxHeight : fullSize && params.availableHeight; |
| 80 | } |
| 81 | } |
| 82 | return stacks; |
| 83 | } |
| 84 | |
| 85 | function buildLayoutBoxes(boxes) { |
| 86 | const layoutBoxes = wrapBoxes(boxes); |