Skip to content

Commit

Permalink
[big_number] fix subheader is missing (#1146)
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch authored Sep 20, 2016
1 parent d15a212 commit 32980a6
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions caravel/assets/visualizations/big_number.js
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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')
Expand Down

0 comments on commit 32980a6

Please sign in to comment.