wet-boew / wet-boew

Web Experience Toolkit (WET): Open source code library for building innovative websites that are accessible, usable, interoperable, mobile-friendly and multilingual. This collaborative open source project is led by the Government of Canada.

Home Page:https://wet-boew.github.io/wet-boew/index-en.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

wb-charts: Non-normalized table values in custom label formatter?

joel-i-gallant opened this issue · comments

We have a requirement to display a formatted version of the values displayed in the pie chart's table but the values that are returned in the 'series' object (series.data[0][1], for example) appear to be normalized and not useful or consistent enough to transform into a formatted number in $ millions (e.g. a value of 11,000 would show as $M 0.011 on the label, where 550,000 would show as $M 0.550).

The values per table could range from tens of thousands to millions; when inspecting the series' data array, some values are normalized / truncated to 3-digits (e.g. 11,000 becomes 110 in series.data[0][1]) but the scale of that normalized value isn't consistent with another table value, say of 550,000, which was also truncated to 3-digits (e.g. 550,000 becomes 550 in series.data[0][1]). Trying to format the charts' labels with values in millions of dollars by dividing by 1000 or 10000 just isn't consistent, but perhaps I'm missing something here.

Is there a way to get the original, non-normalized table value back along with the series data for a custom label formatter function?