Skip to content

Commit

Permalink
fix sizing for single digits
Browse files Browse the repository at this point in the history
  • Loading branch information
alanna scott committed Apr 5, 2017
1 parent d40ce52 commit 464a867
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion superset/assets/visualizations/big_number.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ function bigNumberVis(slice, payload) {
const formattedNumber = f(v);

// Printing big number
let bigNumberFontSize = (width / formattedNumber.length) * 1.3;
if (formattedNumber.length === 1) {
bigNumberFontSize = (width / 2) * 1.3;
}
g.append('g')
.attr('class', 'digits')
.attr('opacity', 1)
Expand All @@ -84,7 +88,7 @@ function bigNumberVis(slice, payload) {
.style('cursor', 'pointer')
.text(formattedNumber)
.attr('font-family', 'Roboto')
.attr('font-size', (width / formattedNumber.length) * 1.3)
.attr('font-size', bigNumberFontSize)
.style('text-anchor', 'middle')
.attr('fill', 'black');

Expand Down

0 comments on commit 464a867

Please sign in to comment.