Skip to content

Commit

Permalink
fix #4738; legend height when position is bottom
Browse files Browse the repository at this point in the history
  • Loading branch information
junedchhipa committed Oct 1, 2024
1 parent 821754e commit e13f3c6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/modules/legend/Legend.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,13 +317,16 @@ class Legend {

let elLegendWrap = w.globals.dom.elLegendWrap

const legendRect = elLegendWrap.getBoundingClientRect()
const legendHeight = elLegendWrap.clientHeight

let x = 0
let y = 0

if (w.config.legend.position === 'bottom') {
y = w.globals.svgHeight - legendRect.height - 5
y =
w.globals.svgHeight -
Math.min(legendHeight, w.globals.svgHeight / 2) -
5
} else if (w.config.legend.position === 'top') {
const dim = new Dimensions(this.ctx)
const titleH = dim.dimHelpers.getTitleSubtitleCoords('title').height
Expand Down

0 comments on commit e13f3c6

Please sign in to comment.