ciao a tutti,
sto cercando di ottimizzare l'uso jpgraph usando delle funzioni
il codice da cui parto è tipo questo:
Codice PHP:
$graph->xaxis->SetTickLabels($datax);
// Create the bar plots
$bplot1 = new BarPlot($data1y);
$bplot1->SetFillColor("$color[1]");
$bplot2= new BarPlot($data2y);
$bplot2->SetFillColor("$color[2]");
per creare le colonne del grafico e
Codice PHP:
$gbplot = new AccBarPlot(array($bplot1,$bplot2,$bplot3,$bplot4));
per impilarlo.
non sapendo quanti possono essere i grafici da impilare ho strasformato il codice così
Codice PHP:
foreach ($datay as $k => $value) {
$bplot[$k] = new BarPlot($value);
$bplot[$k]->SetFillColor($color[$k]);
if (isset($grafico_tot)) {$grafico_tot.=",".$bplot[$k];}
else {$grafico_tot.=$bplot[$k];}
}
e poi
Codice PHP:
$gbplot = new AccBarPlot(array($grafico_tot));
ma non va
mentre funge se scrivo
Codice PHP:
$gbplot = new AccBarPlot(array($bplot[1],$bplot[2],$bplot[3],$bplot[4]));
è ok.
sapete dirmi come posso fare per rendere la generazione dell'ulltima riga dipendente dal array $datay?
in breve, come faccio a fare in modo che inpili gli n. oggetti creati?
eraclito