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);
Source: stackoverflow.com
Related Query
- How to add a (custom) thousand separator in D3?
- d3.format thousand separator on variables?
- How to make custom thousand separator and decimal character in D3.js in Version 5.7.0
- how to format time on xAxis use d3.js
- Date format in D3.js
- Generate (multilevel) flare.json data format from flat json
- converting numbers on y axis to string with K for thousand d3.js
- Customize the d3 month or year tick format
- Proper format for drawing polygon data in D3
- Format a number with SI Prefix, with fixed number of decimals
- Format Y axis values, original figures in millions, only want to show first three digits
- Understanding nvd3 x-axis date format
- d3 js Hierarchical edge bundling Data Format
- abbreviated month format for x-axis in d3.js
- Converting ctree output into JSON Format (for D3 tree layout)
- D3.js time scale tick marks - Years and months only - Custom time format
- nvd3 tooltip decimal format
- how do i format the value shown in a d3 graph
- D3.JS: Format as currency euro
- How to format the Y axis values on Rickshaw Graphs
- Add timestamp format to line graph x-axes
- D3 - data format required for cal-heatmap calendar heatmap?
- d3.js: get tick format from time scale
- D3: "SVG4601: SVG Path data has incorrect format and could not be completely parsed."
- D3.js- How to format tick values as quarters instead of months
- I'm getting JavaScript error "d.getMonth is not a function" when trying to format a date using d3.time.format
- d3.js, click action to another URL encoding with array of variables of sunburst
- git graph parent child tabular format
- How to format seconds to H:M:S using d3js.org
- In R plotly d3js how to format a number with space instead of comma?
More Query from same tag
- Scale a circle's radius (given in meters) to D3.js d3.geo.mercator map
- d3.js nodes are not exiting properly
- Trying to create a map with D3, but it isn't showing up
- Rotate text on half of custom circular axis
- c3.js time format in tooltip
- d3 v5 axis with Typescript = type errors
- CSS and D3 - Making Responsive SVGs in FIREFOX
- callback function returning undefined
- Change one node color in d3
- dc.js - onClick to grab key value
- Simple d3 line not working with Angular 8
- Proper manipulation of JSON data to create D3 area chart?
- render d3 linear nice scale with whole numbers only
- How to convert dictionary (nested object) into d3-usable array for treemap
- crossfilter order by count
- Text does not stay wrapped on d3 tree nodes
- d3 rollup on each csv columns
- append a circle in middle of all my path (sunburst)
- Why is the color of the bars not filling and staying white? d3js
- D3 arrow marker
- How can I make my upside-downed stacked graph right using d3.js?
- SVG nodes in D3 force layout moves on node scale
- How to draw area/fill between two curved lines of different lengths (different x values) in d3
- d3.js bar chart new data adding onto bars,
- d3js drag a text from html DOM and add it to SVG on drop
- How to change opacity on second click?
- d3.js v4 stacked bar tooltip / hover (using modified d3-tip) offset issue
- d3.js data missing, how can I fix it?
- What is the difference between .append and .join in D3.js
- Dimple.js - Add data labels to each bar of the bar chart