From 7d7a5668a0b6644cd39bd24e37d15a12ee219a54 Mon Sep 17 00:00:00 2001 From: Krist Wongsuphasawat Date: Thu, 6 Sep 2018 17:14:39 -0700 Subject: [PATCH 1/3] Move BigNumber to directory. --- .../{big_number.css => BigNumber/BigNumber.css} | 0 .../src/visualizations/{ => BigNumber}/BigNumber.jsx | 10 +++++----- superset/assets/src/visualizations/index.js | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) rename superset/assets/src/visualizations/{big_number.css => BigNumber/BigNumber.css} (100%) rename superset/assets/src/visualizations/{ => BigNumber}/BigNumber.jsx (96%) 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 96% rename from superset/assets/src/visualizations/BigNumber.jsx rename to superset/assets/src/visualizations/BigNumber/BigNumber.jsx index e2658f38c016e..6d227074bdb37 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, diff --git a/superset/assets/src/visualizations/index.js b/superset/assets/src/visualizations/index.js index 93e680915cb18..d6445c46b56a1 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, From cdb456ddaf7efb4f3fc39ea924206896aeba187c Mon Sep 17 00:00:00 2001 From: Krist Wongsuphasawat Date: Thu, 6 Sep 2018 17:35:11 -0700 Subject: [PATCH 2/3] fix chart margin in dashboard --- .../src/dashboard/components/gridComponents/ChartHolder.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/superset/assets/src/dashboard/components/gridComponents/ChartHolder.jsx b/superset/assets/src/dashboard/components/gridComponents/ChartHolder.jsx index 9ad9522965dcd..0598635c35b06 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 { > Date: Thu, 6 Sep 2018 17:43:04 -0700 Subject: [PATCH 3/3] Fix margin and be more conservative about width. --- superset/assets/src/visualizations/BigNumber/BigNumber.jsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/superset/assets/src/visualizations/BigNumber/BigNumber.jsx b/superset/assets/src/visualizations/BigNumber/BigNumber.jsx index 6d227074bdb37..3c5cffbc5e670 100644 --- a/superset/assets/src/visualizations/BigNumber/BigNumber.jsx +++ b/superset/assets/src/visualizations/BigNumber/BigNumber.jsx @@ -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}