?
Dear all,
I have got the four people’s evaluation results in percent value and displayed them in bar graph in four diffrent colours.
What I want to give the legends with four people’s names on the same graph.
I tried with an array, but it shows only the word “array” with color of the first graph “green” as the legend.
How can one show that each of the four persons name x,y…etc on this graph as the legend.
The codes are as follows;
$datay=array( $a_row[‘APPRAISERPERC’], $a_row[‘APPRAISSEEPERC’], $a_row[‘SUBPERC’], $a_row[‘PEERPERC’]);
$colors=array(“green”,”blue”,”red”,”gray4″);
$legends=array(‘appraiser%’,’appraisee%’,’subordinate%’,’peer%’);
// Setup the graph.
$graph = new Graph(400,200,”auto”);
$graph->img->SetMargin(60,30,30,40);
$graph->SetScale(“textlin”);
$graph->SetMarginColor(“teal”);
$graph->SetShadow();
// Create the bar pot
$bplot = new BarPlot($datay);
//$bplot1 = new BarPlot(‘array[1]’);
$bplot->SetWidth(0.6);
// This is how you make the bar graph start from something other than 0
$bplot->SetYMin(0);
// Setup color for gradient fill style
$tcol=array(100,100,255);
$fcol=array(255,100,100);
//$bplot->SetFillGradient($fcol,$tcol,GRAD_HOR);
//setup different colors for bars
$bplot->SetFillColor($colors =array(“green”,”blue”,”red”,”gray4″));
$bplot->SetLegend($legends=array(‘x’,’y’,’r’,’z’));//=array(‘appraiser%’));//,”appraisee%”,”subordinate%”,”peer%”));
//display the value on top of each bar
$bplot->value->show();
$graph->Add($bplot);
// Set up the title for the graph
$graph->title->Set(“Bargraph of four evaluators’ Percent values”);
$graph->title->SetColor(“yellow”);
$graph->title->SetFont(FF_VERDANA,FS_BOLD,12);
//add the space at the top of the scale by using SetGrace().
$graph->yaxis->scale->SetGrace(20);
//$graph->legend->SetLayout(Legend_HOR);
// Setup color for axis and labels
$graph->xaxis->SetColor(“black”,”white”);
$graph->yaxis->SetColor(“black”,”white”);
// Setup font for axis
$graph->xaxis->SetFont(FF_VERDANA,FS_NORMAL,10);
$graph->yaxis->SetFont(FF_VERDANA,FS_NORMAL,10);
// Setup X-axis title (color & font)
$graph->xaxis->title->Set(“Four Evaluators”);
$graph->xaxis->title->SetColor(“white”);
$graph->xaxis->title->SetFont(FF_VERDANA,FS_BOLD,10);
$graph->yaxis->title->Set(“Percentage Value”);
$graph->yaxis->title->SetColor(“white”);
$graph->yaxis->title->SetFont(FF_VERDANA,FS_BOLD,10);
$graph->yaxis->SetLabelAlign(‘center’,’right’);
// Finally send the graph to the browser
$graph->Stroke();
?>
Please help me.
Regards,
wasantha