I have the following script:
var data = JSON.parse( '<?php echo json_encode($lista_tipo_indicadores) ?>' );
var cores = JSON.parse('<?php echo json_encode($cores) ?>');
// Quantidade de Indicadores por Tipo
var doughnutData = [
{
value: data[0].total,
color:cores[0],
highlight: "#FF5A5E",
label: data[0].nome
},
{
value: data[1].total,
color: cores[1],
highlight: "#5AD3D1",
label: data[1].nome
},
{
value: data[2].total,
color: cores[2],
highlight: "#FFC870",
label: data[2].nome
},
{
value: data[3].total,
color: cores[3],
highlight: "#5AD3D1",
label: data[3].nome
},
{
value: data[4].total,
color: cores[4],
highlight: "#FFC870",
label: data[4].nome
},
{
value: data[5].total,
color: cores[5],
highlight: "#5AD3D1",
label: data[5].nome
},
{
value: data[6].total,
color: cores[6],
highlight: "#FFC870",
label: data[6].nome
},
{
value: data[7].total,
color: cores[7],
highlight: "#FFC870",
label: data[7].nome
}
];
How do I get the variable to be generated dynamically, with some foreach?