In my JS, I am trying to add a for loop in amCharts guides to have 3 guides labels and their values passed from a views file.
I am currently working with this:
"guides": [{
"dashLength": 6,
"inside": true,
"label": graphConfig.dataProvider[0].label[0],
"labelRotation":90,
"lineAlpha": 1,
"category": graphConfig.dataProvider[0].val[0],
}, {
"dashLength": 6,
"inside": true,
"label": graphConfig.dataProvider[0].label[1],
"labelRotation":90,
"lineAlpha": 1,
"category": graphConfig.dataProvider[0].val[1],
}, {
"dashLength": 6,
"inside": true,
"label": graphConfig.dataProvider[0].label[2],
"labelRotation":90,
"lineAlpha": 1,
"category": graphConfig.dataProvider[0].val[2],
}],
It is working fine, but if I have to scale it I need a loop. I am looking for something like this:
"guides": [
for (var i=0; i<3; i++)
{
{
"dashLength": 6,
"inside": true,
"label": graphConfig.dataProvider[0].label[i],
"labelRotation":90,
"lineAlpha": 1,
"category": graphConfig.dataProvider[0].val[i],
},
}
But this is not working. Help me out please.