Skip to content

Commit

Permalink
fix auto height increase when height is 100% - fixes #2059
Browse files Browse the repository at this point in the history
  • Loading branch information
junedchhipa committed Nov 21, 2020
1 parent 4b46d33 commit a11a332
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 25 deletions.
20 changes: 11 additions & 9 deletions src/modules/Core.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,15 +329,17 @@ export default class Core {
height: gl.svgHeight
})

// gl.dom.Paper.node.parentNode.parentNode.style.minWidth = gl.svgWidth + "px";
let offsetY = cnf.chart.sparkline.enabled
? 0
: gl.axisCharts
? cnf.chart.parentHeightOffset
: 0

gl.dom.Paper.node.parentNode.parentNode.style.minHeight =
gl.svgHeight + offsetY + 'px'
if (cnf.chart.height.indexOf('%') === -1) {
// fixes https://github.com/apexcharts/apexcharts.js/issues/2059
let offsetY = cnf.chart.sparkline.enabled
? 0
: gl.axisCharts
? cnf.chart.parentHeightOffset
: 0

gl.dom.Paper.node.parentNode.parentNode.style.minHeight =
gl.svgHeight + offsetY + 'px'
}

gl.dom.elWrap.style.width = gl.svgWidth + 'px'
gl.dom.elWrap.style.height = gl.svgHeight + 'px'
Expand Down
21 changes: 5 additions & 16 deletions src/utils/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,22 +153,11 @@ class Utils {
}

static getDimensions(el) {
let computedStyle = getComputedStyle(el)
let ret = []

let elementHeight = el.clientHeight
let elementWidth = el.clientWidth

elementHeight -=
parseFloat(computedStyle.paddingTop) +
parseFloat(computedStyle.paddingBottom)
elementWidth -=
parseFloat(computedStyle.paddingLeft) +
parseFloat(computedStyle.paddingRight)
ret.push(elementWidth)
ret.push(elementHeight)

return ret
const computedStyle = getComputedStyle(el, null)

const height = parseFloat(computedStyle.height)
const width = parseFloat(computedStyle.width)
return [width, height]
}

static getBoundingClientRect(element) {
Expand Down

0 comments on commit a11a332

Please sign in to comment.