fix sizing for single digits

This commit is contained in:
alanna scott 2017-04-04 21:15:56 -07:00
parent d40ce52139
commit 464a867a00

View File

@ -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)
@ -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');