Code based on https://www.amcharts.com/docs/v4/concepts/performance/ https://codepen.io/team/amcharts/pen/KYRvNd/