From 97eb40ada04fcbc18f7c3e34a3f51f3516c49515 Mon Sep 17 00:00:00 2001 From: alanna scott Date: Wed, 5 Apr 2017 12:16:20 -0700 Subject: [PATCH 1/2] use cardinal so scatterplot lines up properly --- superset/assets/visualizations/big_number.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/superset/assets/visualizations/big_number.js b/superset/assets/visualizations/big_number.js index d0915a16162fe..437d3d337becc 100644 --- a/superset/assets/visualizations/big_number.js +++ b/superset/assets/visualizations/big_number.js @@ -63,7 +63,7 @@ function bigNumberVis(slice, payload) { const line = d3.svg.line() .x(d => scaleX(d[0])) .y(d => scaleY(d[1])) - .interpolate('basis'); + .interpolate('cardinal'); let y = height / 2; let g = svg.append('g'); From c74de86857e684d9e5d689e5a00de8027474b23e Mon Sep 17 00:00:00 2001 From: alanna scott Date: Wed, 5 Apr 2017 12:16:35 -0700 Subject: [PATCH 2/2] use min 30 for margins, accounts for small y axis labels --- superset/assets/visualizations/big_number.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/superset/assets/visualizations/big_number.js b/superset/assets/visualizations/big_number.js index 437d3d337becc..b64ed59548d75 100644 --- a/superset/assets/visualizations/big_number.js +++ b/superset/assets/visualizations/big_number.js @@ -50,8 +50,9 @@ function bigNumberVis(slice, payload) { const valueExt = d3.extent(data, (d) => d[1]); const yAxisLabelWidths = valueExt.map(value => getTextWidth(f(value), '10px Roboto')); const yAxisMaxWidth = Math.max(...yAxisLabelWidths); - const margin = yAxisMaxWidth + (yAxisMaxWidth / 2); - + let margin = yAxisMaxWidth + (yAxisMaxWidth / 2); + // make sure margin is minimum 30px, for the case when the y axix label is very small. + if (margin < 30) margin = 30; const scaleX = d3.time.scale.utc().domain(dateExt).range([margin, width - margin]); const scaleY = d3.scale.linear().domain(valueExt).range([height - (margin), margin]); const colorRange = [d3.hsl(0, 1, 0.3), d3.hsl(120, 1, 0.3)];