You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by mi...@apache.org on 2022/08/30 12:41:44 UTC

[superset] 06/13: fix(chart): chart gets cut off on the dashboard (#20315)

This is an automated email from the ASF dual-hosted git repository.

michaelsmolina pushed a commit to branch 1.5
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 8e1b2a1354b1a3c089102835bc0114c4847f9e78
Author: Stephen Liu <75...@qq.com>
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
    
    (cherry picked from commit 07b4a7159dd293061b83c671ad64cc51c928a199)
---
 .../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 b212af44e5..b852523f17 100644
--- a/superset-frontend/src/dashboard/components/gridComponents/Chart.jsx
+++ b/superset-frontend/src/dashboard/components/gridComponents/Chart.jsx
@@ -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) {