friky.com
← Back to archive

Post

Adding percentages to labels in amcharts5

2023-01-13 Agustí Pons Original post

Amcharts5 is a very powerful graphics library, however the documentation is really scarce.

If you want to add the percentage of a value in some label you must use the undocumented valuePercentTotal attribute in the desired text label, for example.

legendValueText: "[bold {fill}]{value} {valuePercentTotal.formatNumber('0.00p')}[/]"

Generates a label like this:

This value can be used in different labels and can be formatted as the other attributes like "value".

Hope this helps