by menjada » Tue Feb 04, 2003 1:18 pm
My speciallity is not PHP. Therfore i ask u to help me.
I use the JPgraph to make a graph.
Bu i need convert? my sql/php question to this variabel:
$data1y=array(112,8,19,3,10,5);
Some sort of array i think.
My SQl/php question:
$sql = mysql_query("SELECT impressions FROM $table WHERE annons_id = '$annons_id' ORDER BY datum DESC");
And then???
Whole script:
$data1y=array(112,8,19,3,10,5);
$data2y=array(8,2,11,7,14,4);
$data3y=array(8,2,11,7,14,4);
// Create the graph. These two calls are always required
$graph = new Graph(600,200,"auto");
$graph->img->SetMargin(40,30,20,40);
$graph->SetScale("textlin");
$graph->SetShadow();
// Create the bar plots
$b1plot = new BarPlot($data1y);
$b1plot->SetFillColor("orange");
$b2plot = new BarPlot($data2y);
$b2plot->SetFillColor("blue");
$b3plot = new BarPlot($data3y);
$b3plot->SetFillColor("red");
// Create the grouped bar plot
$gbplot = new GroupBarPlot(array($b1plot,$b2plot,$b3plot));
// ...and add it to the graPH
$graph->Add($gbplot);
$graph->title->Set("Annonsstatistik");
$graph->xaxis->title->Set("Dag");
$graph->yaxis->title->Set("Stat");
$graph->title->SetFont(FF_FONT1,FS_BOLD);
$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
// Display the graph
$graph->Stroke();