john-bodley closed pull request #5839: [bugfix] Fix bignumber overflow in 
dashboard
URL: https://github.com/apache/incubator-superset/pull/5839
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/superset/assets/src/dashboard/components/gridComponents/ChartHolder.jsx 
b/superset/assets/src/dashboard/components/gridComponents/ChartHolder.jsx
index 9ad9522965..0598635c35 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 e2658f38c0..3c5cffbc5e 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 93e680915c..d6445c46b5 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,


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to