This is an automated email from the ASF dual-hosted git repository.
stephenlyz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new 07b4a7159d fix(chart): chart gets cut off on the dashboard (#20315)
07b4a7159d is described below
commit 07b4a7159dd293061b83c671ad64cc51c928a199
Author: Stephen Liu <[email protected]>
AuthorDate: Thu Jun 9 22:59:58 2022 +0800
fix(chart): chart gets cut off on the dashboard (#20315)
* fix(chart): chart gets cut off on the dashboard
* add some failsafe
* address comment
---
.../src/dashboard/components/gridComponents/Chart.jsx | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git
a/superset-frontend/src/dashboard/components/gridComponents/Chart.jsx
b/superset-frontend/src/dashboard/components/gridComponents/Chart.jsx
index 5232f51e4d..fc3f6d39b3 100644
--- a/superset-frontend/src/dashboard/components/gridComponents/Chart.jsx
+++ b/superset-frontend/src/dashboard/components/gridComponents/Chart.jsx
@@ -224,9 +224,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) {