Skip to content

Commit

Permalink
Corrected chart width for sub-pixel container width. Prevented overfl…
Browse files Browse the repository at this point in the history
…ow in flex-grids and table cells. See #6427. Closes #1758. Closes #5070. Closes #5153. Closes #5673. Closes #8312.
  • Loading branch information
TorsteinHonsi committed Nov 5, 2018
1 parent 8547ef0 commit 02b559d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions js/parts/Chart.js
Expand Up @@ -1134,6 +1134,10 @@ extend(Chart.prototype, /** @lends Highcharts.Chart.prototype */ {
chartWidth = chart.chartWidth;
chartHeight = chart.chartHeight;

// Allow table cells and flex-boxes to shrink without the chart blocking
// them out (#6427)
css(renderTo, { overflow: 'hidden' });

// Create the inner container
/*= if (build.classic) { =*/
containerStyle = extend({
Expand Down
10 changes: 9 additions & 1 deletion js/parts/Utilities.js
Expand Up @@ -2009,9 +2009,17 @@ H.getStyle = function (el, prop, toInt) {
if (prop === 'width') {
return Math.max(
0, // #8377
Math.min(el.offsetWidth, el.scrollWidth) -
(
Math.min(
el.offsetWidth,
el.scrollWidth,
el.getBoundingClientRect ?
Math.floor(el.getBoundingClientRect().width) : // #6427
Infinity
) -
H.getStyle(el, 'padding-left') -
H.getStyle(el, 'padding-right')
)
);
} else if (prop === 'height') {
return Math.max(
Expand Down

0 comments on commit 02b559d

Please sign in to comment.