Hi,
I need some help. I need to be able to display my graph with text above and below the actual PHP graph.
http://132.156.178.22/stephweb/php/stephanie.php
I tried even printing a simple "Hello World" string, but it seems as if the script stops after the Stroke();
Is there an easy way to do this?
Can anyone help me?
Thanks,
Stephanie
My Code
<?php
include ("../jpgraph.php");
include ("../jpgraph_bar.php");
$data1y=array(12,8,19); // house
$data2y=array(8,2,11); // potential
// Create the graph. These two calls are always required
$graph = new Graph(400,300,"auto"); //(length, height)
$graph->SetScale("textlin",0,35);
$graph->yscale->ticks->Set(35,10);
$graph->yaxis->SetColor("lightblue");
$graph->SetMarginColor("lightblue");
$a = array("Heating\nConsumption","Cooling\nConsumption ","Hot Water Tank\nConsumption");
$graph->xaxis->SetLabelAlign('center');
$graph->xaxis->SetTickLabels($a);
$graph->xaxis->SetFont(FF_ARIAL);
$graph->SetShadow();
$graph->img->SetMargin(40,30,20,80);
// Create the bar plots
$b1plot = new BarPlot($data1y);
$b1plot->SetFillColor("midnightblue");
$b1plot->SetLegend("Your House");
$b2plot = new BarPlot($data2y);
$b2plot->SetFillColor("steelblue3");
$b2plot->SetLegend("Your Potential");
$gbplot = new GroupBarPlot(array($b1plot,$b2plot));
$gbplot->SetWidth(0.7);
// ...and add it to the graPH
$graph->Add($gbplot);
$graph->title->SetFont(FF_ARIAL,FS_BOLD,20);
$graph->yaxis->title->SetFont(FF_ARIAL,FS_BOLD);
$graph->xaxis->title->SetFont(FF_ARIAL,FS_BOLD);
$graph->title->Set("Energy Consumption");
$graph->yaxis->title->Set("Energy");
// Display the graph
$graph->Stroke();
print("Hello<br>");
?>