[Solved] Fixed point rounding

Is there a helper to round numbers to a fixed number of digits after the decimal, similar to JavaScript toFixed()? I’d like to tidy up numbers before presentation in the HTML of the sendgrid node.

Yup! You can use the format helper to format a number however you would like.

You are referring to {{format val formatStr}}?

That’s the one, yes. D3 Format can be a bit complicated but that also provides you a lot of flexibility in how you want the numbers to display.

In your case, if you wanted to round the number 1234.56 to the nearest whole number and include the comma after the thousands digit, the format would be .4n.

Here are some common D3 examples and a tester where you can enter a value and your own format to see how it will behave.

That’s a great page and makes thing much more clear.

Thank you so much!