Skip to content

Commit

Permalink
fix(chart): chart gets cut off on the dashboard (apache#20315)
Browse files Browse the repository at this point in the history
* fix(chart): chart gets cut off on the dashboard

* add some failsafe

* address comment

(cherry picked from commit 07b4a71)
  • Loading branch information
stephenLYZ authored and sadpandajoe committed Jun 9, 2022
1 parent 7341e5c commit 5ecd9fd
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,14 @@ export default class Chart extends React.Component {
}

getHeaderHeight() {
return (
(this.headerRef && this.headerRef.offsetHeight) || DEFAULT_HEADER_HEIGHT
);
if (this.headerRef) {
const computedStyle = getComputedStyle(this.headerRef).getPropertyValue(
'margin-bottom',
);
const marginBottom = parseInt(computedStyle, 10) || 0;
return this.headerRef.offsetHeight + marginBottom;
}
return DEFAULT_HEADER_HEIGHT;
}

setDescriptionRef(ref) {
Expand Down

0 comments on commit 5ecd9fd

Please sign in to comment.