(chartArea, params, layout, stacks)
| 114 | } |
| 115 | |
| 116 | function updateDims(chartArea, params, layout, stacks) { |
| 117 | const {pos, box} = layout; |
| 118 | const maxPadding = chartArea.maxPadding; |
| 119 | |
| 120 | // dynamically placed boxes size is not considered |
| 121 | if (!isObject(pos)) { |
| 122 | if (layout.size) { |
| 123 | // this layout was already counted for, lets first reduce old size |
| 124 | chartArea[pos] -= layout.size; |
| 125 | } |
| 126 | const stack = stacks[layout.stack] || {size: 0, count: 1}; |
| 127 | stack.size = Math.max(stack.size, layout.horizontal ? box.height : box.width); |
| 128 | layout.size = stack.size / stack.count; |
| 129 | chartArea[pos] += layout.size; |
| 130 | } |
| 131 | |
| 132 | if (box.getPadding) { |
| 133 | updateMaxPadding(maxPadding, box.getPadding()); |
| 134 | } |
| 135 | |
| 136 | const newWidth = Math.max(0, params.outerWidth - getCombinedMax(maxPadding, chartArea, 'left', 'right')); |
| 137 | const newHeight = Math.max(0, params.outerHeight - getCombinedMax(maxPadding, chartArea, 'top', 'bottom')); |
| 138 | const widthChanged = newWidth !== chartArea.w; |
| 139 | const heightChanged = newHeight !== chartArea.h; |
| 140 | chartArea.w = newWidth; |
| 141 | chartArea.h = newHeight; |
| 142 | |
| 143 | // return booleans on the changes per direction |
| 144 | return layout.horizontal |
| 145 | ? {same: widthChanged, other: heightChanged} |
| 146 | : {same: heightChanged, other: widthChanged}; |
| 147 | } |
| 148 | |
| 149 | function handleMaxPadding(chartArea) { |
| 150 | const maxPadding = chartArea.maxPadding; |
no test coverage detected
searching dependent graphs…