Search code examples
amcharts4

Amcharts4 numberFormatter percentage doesn't work


Reading https://www.amcharts.com/docs/v4/concepts/formatters/formatting-numbers/, it seems to me that to display data as percentages you only need to write :

chart.numberFormatter.numberFormat = "%";

However, not only it doesn't work, but it also hides all data-related information. It seems to be a bug because other formats such as "#.##" work fine.

Here is a stackblitz : https://stackblitz.com/edit/typescript-1arbck

Any help is appreciated !


Solution

  • If you want to show the percentage value in chart, then calculate the percentage value at front/back end and the show the value in chart. Sometimes Amcharts percentage calculation will not match with your calculated percentage value. Also, use chart.numberFormatter.numberFormat = "#.## '%'"; to show the percentage sign.