Skip to content Skip to sidebar Skip to footer

Where Can In Find The Locale Objects For D3.js For Different Countries

this url (https://github.com/mbostock/d3/wiki/Localization) shows two examples for locales en_US: { 'decimal': '.', 'thousands': ',', 'grouping': [3], 'currenc

Solution 1:

D3 does not load any localization strings, it creates a new object that handles the localization via d3.locale method. In the D3 source, there are some pre-made definitions; you can find them at:

When you want to use the format of another locale than en-US, this is an example for you:

var esLocaleDef = {...}; // your definition, you can copy from es-Es.js file in the above folder.
var esLocale = d3.locale(esLocaleDef);

// use esLocale.numberFormat instead of d3.format
var esNumberFormat = esLocale.numberFormat(...);

// use esLocale.timeFormat instead of d3.time.format
var esTimeFormat = esLocale.timeFormat(...);

Post a Comment for "Where Can In Find The Locale Objects For D3.js For Different Countries"