superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From johnbod...@apache.org
Subject [incubator-superset] branch master updated: [bugfix] Fix bignumber overflow in dashboard (#5839)
Date Fri, 07 Sep 2018 04:48:48 GMT
This is an automated email from the ASF dual-hosted git repository.

johnbodley pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 3f8b970  [bugfix] Fix bignumber overflow in dashboard (#5839)
3f8b970 is described below

commit 3f8b970a88136623179f37afc4af4fb0d4ee6dd2
Author: Krist Wongsuphasawat <krist.wongz@gmail.com>
AuthorDate: Thu Sep 6 21:48:41 2018 -0700

    [bugfix] Fix bignumber overflow in dashboard (#5839)
    
    * Move BigNumber to directory.
    
    * fix chart margin in dashboard
    
    * Fix margin and be more conservative about width.
---
 .../dashboard/components/gridComponents/ChartHolder.jsx  |  2 +-
 .../{big_number.css => BigNumber/BigNumber.css}          |  0
 .../src/visualizations/{ => BigNumber}/BigNumber.jsx     | 16 ++++++++--------
 superset/assets/src/visualizations/index.js              |  4 ++--
 4 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/superset/assets/src/dashboard/components/gridComponents/ChartHolder.jsx b/superset/assets/src/dashboard/components/gridComponents/ChartHolder.jsx
index 9ad9522..0598635 100644
--- a/superset/assets/src/dashboard/components/gridComponents/ChartHolder.jsx
+++ b/superset/assets/src/dashboard/components/gridComponents/ChartHolder.jsx
@@ -131,7 +131,7 @@ class ChartHolder extends React.Component {
             >
               <Chart
                 id={component.meta.chartId}
-                width={widthMultiple * columnWidth}
+                width={widthMultiple * columnWidth - CHART_MARGIN / 2}
                 height={component.meta.height * GRID_BASE_UNIT - CHART_MARGIN}
                 sliceName={component.meta.sliceName || ''}
                 updateSliceName={this.handleUpdateSliceName}
diff --git a/superset/assets/src/visualizations/big_number.css b/superset/assets/src/visualizations/BigNumber/BigNumber.css
similarity index 100%
rename from superset/assets/src/visualizations/big_number.css
rename to superset/assets/src/visualizations/BigNumber/BigNumber.css
diff --git a/superset/assets/src/visualizations/BigNumber.jsx b/superset/assets/src/visualizations/BigNumber/BigNumber.jsx
similarity index 95%
rename from superset/assets/src/visualizations/BigNumber.jsx
rename to superset/assets/src/visualizations/BigNumber/BigNumber.jsx
index e2658f3..3c5cffb 100644
--- a/superset/assets/src/visualizations/BigNumber.jsx
+++ b/superset/assets/src/visualizations/BigNumber/BigNumber.jsx
@@ -4,12 +4,12 @@ import ReactDOM from 'react-dom';
 import * as color from 'd3-color';
 import { XYChart, AreaSeries, CrossHair, LinearGradient } from '@data-ui/xy-chart';
 
-import { brandColor } from '../modules/colors';
-import { d3FormatPreset } from '../modules/utils';
-import { formatDateVerbose } from '../modules/dates';
-import { computeMaxFontSize } from '../modules/visUtils';
+import { brandColor } from '../../modules/colors';
+import { d3FormatPreset } from '../../modules/utils';
+import { formatDateVerbose } from '../../modules/dates';
+import { computeMaxFontSize } from '../../modules/visUtils';
 
-import './big_number.css';
+import './BigNumber.css';
 
 const CHART_MARGIN = {
   top: 4,
@@ -98,7 +98,7 @@ class BigNumberVis extends React.Component {
     document.body.appendChild(container);
     const fontSize = computeMaxFontSize({
       text,
-      maxWidth: width,
+      maxWidth: Math.floor(width),
       maxHeight,
       className: 'header_line',
       container,
@@ -126,7 +126,7 @@ class BigNumberVis extends React.Component {
       document.body.appendChild(container);
       fontSize = computeMaxFontSize({
         text: subheader,
-        maxWidth: width,
+        maxWidth: Math.floor(width),
         maxHeight,
         className: 'subheader_line',
         container,
@@ -165,7 +165,7 @@ class BigNumberVis extends React.Component {
           type: 'linear',
           includeZero: startYAxisAtZero,
         }}
-        width={width}
+        width={Math.floor(width)}
         height={maxHeight}
         margin={CHART_MARGIN}
         renderTooltip={renderTooltip}
diff --git a/superset/assets/src/visualizations/index.js b/superset/assets/src/visualizations/index.js
index 93e6809..d6445c4 100644
--- a/superset/assets/src/visualizations/index.js
+++ b/superset/assets/src/visualizations/index.js
@@ -65,9 +65,9 @@ const vizMap = {
   [VIZ_TYPES.area]: loadNvd3,
   [VIZ_TYPES.bar]: loadNvd3,
   [VIZ_TYPES.big_number]: () =>
-    loadVis(import(/* webpackChunkName: 'big_number' */ './BigNumber.jsx')),
+    loadVis(import(/* webpackChunkName: 'big_number' */ './BigNumber/BigNumber.jsx')),
   [VIZ_TYPES.big_number_total]: () =>
-    loadVis(import(/* webpackChunkName: "big_number" */ './BigNumber.jsx')),
+    loadVis(import(/* webpackChunkName: "big_number" */ './BigNumber/BigNumber.jsx')),
   [VIZ_TYPES.box_plot]: loadNvd3,
   [VIZ_TYPES.bubble]: loadNvd3,
   [VIZ_TYPES.bullet]: loadNvd3,


Mime
View raw message