score:6

Accepted answer

specifying a d3.format returns a formatting function, which you must then call as a function, passing in the number to be formatted as an argument:

var mynumber = 22400;
d3.format(',')(mynumber); // returns '22,400'

sometimes you will see a format function stored as a variable like this:

var commaformat = d3.format(',');
commaformat(1234567); // returns '1,234,567'

in your case, you could do the following:

var totalsales = text + d3.format(',')(obj[0].today);

Related Query