2
I have a Graph Builder that is powered by JSON which I wanted to generate homes dynamically ie have a number of elements stipulated by a variable.
Example of what I tried to do:
<script type="text/javascript">
// Get the context of the canvas element we want to select
var ctx = document.getElementById("piechart").getContext("2d");
var data = [
while(i=2)
{
{
value: <?print $valor;?>,
color:"#F7464A",
highlight: "#FF5A5E",
label: "Red"
},
i++;
}
];
var options = {
animateScale: true
};
var myNewChart = new Chart(ctx).Pie(data,options);
You want to have that
while
in Javascript or PHP?– Sergio