From 32980a653c4e43a381135d5d95fad83e6e14d078 Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Tue, 20 Sep 2016 12:24:29 -0700 Subject: [PATCH] [big_number] fix subheader is missing (#1146) --- caravel/assets/visualizations/big_number.js | 24 ++++++++++----------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/caravel/assets/visualizations/big_number.js b/caravel/assets/visualizations/big_number.js index aa1b9b6fe4..f41047829c 100644 --- a/caravel/assets/visualizations/big_number.js +++ b/caravel/assets/visualizations/big_number.js @@ -77,6 +77,17 @@ function bigNumberVis(slice) { .style('font-size', d3.min([height, width]) / 3.5) .attr('fill', 'white'); + // Printing big number subheader text + if (json.subheader !== null) { + g.append('text') + .attr('x', width / 2) + .attr('y', (height / 16) * 12) + .text(json.subheader) + .attr('id', 'subheader_text') + .style('font-size', d3.min([height, width]) / 8) + .style('text-anchor', 'middle'); + } + if (fd.viz_type === 'big_number') { // Drawing trend line @@ -100,19 +111,6 @@ function bigNumberVis(slice) { const c = scaleColor(vCompare); - // Printing big number subheader text - if (json.subheader !== null) { - g.append('text') - .attr('x', width / 2) - .attr('y', y + d3.min([height, width]) / 4.5) - .text(json.subheader) - .attr('id', 'subheader_text') - .style('font-size', d3.min([height, width]) / 16) - .style('text-anchor', 'middle') - .attr('fill', c) - .attr('stroke', c); - } - // Printing compare % if (vCompare !== null) { g.append('text')