By default D3plus tries to print numbers and text in a clean, consistent way. Sometimes, customization may be required that is outside of this basic formatting.
The .format( ) method provides access to override the default "text" and "number" formatting functions. Each function gets passed both the value being formatted, and the key (if applicable) associated with that value.
In this example, the label "usd" is being changed to "Trade Value" and all values are being prefixed with "$" and suffixed with "USD". Hover over one of the Tree Map squares to see the modified output.
Featured on D3plus.org