Skip to content
Advertisement

Looping in dataLoader amchart v3

I have an array of data, for example, I have 3 Cardview in my view in HTML,

each of the Cardview has their own data, especially in displaying the chart.

I can already get the data in the loop and already can get the value for each chart, but when I run it, only 1 chart is loading and the other 2 Cardview is not loading.

here is my loop and code.

JavaScript

Here is my controller

JavaScript

I can already get the response of the 3 charts, but instead of loading the first response for the chart for the first Cardview

JavaScript

, the value that is showing on the first Cardview is the [2] element instead of First element, I don’t know what to do, I’ve been stuck with this loop in Amchart.

Advertisement

Answer

You need to assign different Ids to your different charts. Currently your code is running in a loop 3 times but each time it is assigning the chart to chartdiv.

You need to have 3 Div like below:

JavaScript

Then in your JS Code inside the loop you need to assign chart to correct div.

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement