• Open in:

Show Percentage Change

If your data already has percent values, then all you need to do is to add % sign to the y axis labels, for this you set number format on the axis:

var yAxis = chart.yAxes.push(am5xy.ValueAxis.new(root, {numberFormat: "#'%'", renderer: am5xy.AxisRendererY.new(root, {}) }));

If your values are not recalculated to percent, there are two options:

1) show the change in percent when first value in the selection is used as a base value. This way first value in the selection will always be 0.
For this, two settings must be added to series:

calculateAggregates: true,valueYShow: "valueYChangePercent"

2) show the change is percent when first value of your data is used as a base value:

For this, two settings must be added to series:

calculateAggregates: true, valueYShow: "valueYChangePercent"

You might want to adjust what you show in a tooltip and legend value. Check the source of this demo – when a switch at the top of a chart is toggled, the chart changes from one mode to another changing tooltip and legend text as well.

Related tutorials

Demo source