This is the code below
<?php
include ("C:/Program Files/xampp/htdocs/HEAVEN/SURVEY_TEST/websurvey/admin/jpgraph-2.1.1/src/jpgraph.php");
include ("C:/Program Files/xampp/htdocs/HEAVEN/SURVEY_TEST/websurvey/admin/jpgraph-2.1.1/src/jpgraph_bar.php");
// Create a query string
$sql_query = "SELECT id_question,answer FROM question_answers_survey";
$res = mysql_query($sql_query) or die(mysql_error());
while($row = mysql_fetch_assoc($res))
{
$data[] = $row[1];
$leg[] = $row[0];
}
$graph = new Graph(300,350,"auto");
$graph->SetScale("textint",1,9);
$graph->SetMargin(30,20,20,60);
$graph->SetMarginColor('#F8FCE6');
$graph->SetBackgroundGradient('#F8FCE6','#F8FCE6',GRAD_HOR,BGRAD_PLOT);
$graph->xaxis->SetTickLabels($leg);
$graph->xaxis->SetLabelAngle(45);
$graph->xaxis->SetFont(FF_ARIAL,FS_NORMAL,8);
$graph->xaxis->SetColor('blue:0.6');
$graph->xaxis->SetColor('blue:0.6');
$graph->yaxis->SetFont(FF_ARIAL,FS_NORMAL,8);
$graph->yaxis->SetColor('blue:0.6');
$graph->ygrid->Show(false);
$bplot = new BarPlot($data);
$bplot->SetFillColor('red'); // Fill color
$bplot->SetShadow('blue');
$bplot->value->Show();
$bplot->value->SetFont(FF_ARIAL,FS_BOLD,8);
$bplot->value->SetColor("blue:0.6","black");
$bplot->value->SetAngle(45);
$bplot->SetWidth(0.88);
$graph->Add($bplot);
$graph->Stroke();
// Close the connection
mysql_close($mysql_conn) or die("Error whilst closing connection: " . mysql_error());
?>
I have removed the connection bit..
It is showing an empty bar chart......is there is more things that needs to be in place?
Pls do help. And how do you get you code to be in different colors while mine is still in black...