Forum Discussion

Martin18's avatar
Martin18
New Member
8 years ago
Solved

valueFormatter ignores culture for displayUnit

Hi all,
 
I'm having little trouble with valueFormatter as I can't get it format my values as expected in terms of the unit abbreviation and the given culture. Even though it produces the correct decimal character (comma), the unit abbreviation still looks like for the default culture ("en-US").
 
Here's what I've done: 
 
visual.ts:
 
 
import valueFormatter = powerbi.extensibility.utils.formatting.valueFormatter;
...
let formatterOptions : utils.formatting.ValueFormatterOptions = {
value: 1000,
precision: 1,
cultureSelector: options.host.locale // "de-DE"
};
let formatter = valueFormatter.create(formatterOptions);
let v = formatter.format(2500); // gives 2,5K and not 2,5 Tsd. :-(
pbiviz.json:
 
... 
"externalJS": [ "node_modules/globalize/lib/globalize.js", "node_modules/globalize/lib/cultures/globalize.cultures.js",
...
Is there anything wrong with my code?
 
Any help will be appreciated. Thank you.

3 Replies