Jpgraph: как да зададете етикет за групова лентова колонна диаграма в php

ето моя демо код на jpgraph:

<?php // content="text/plain; charset=utf-8"
// $Id: groupbarex1.php,v 1.2 2002/07/11 23:27:28 aditus Exp $
require_once ('jpgraph/jpgraph.php');
require_once ('jpgraph/jpgraph_bar.php');

$datay1=array(35,160,0,0,0,0);
$datay2=array(35,190,190,190,190,190);
$datay3=array(20,70,70,140,230,260);

$graph = new Graph(450,200,'auto');    
$graph->SetScale("textlin");
$graph->SetShadow();
$graph->img->SetMargin(40,30,40,40);
$graph->xaxis->SetTickLabels($gDateLocale->GetShortMonth());

$graph->xaxis->title->Set('Year 2002');
$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);

$graph->title->Set('Group bar plot');
$graph->title->SetFont(FF_FONT1,FS_BOLD);

$bplot1 = new BarPlot($datay1);
$bplot2 = new BarPlot($datay2);
$bplot3 = new BarPlot($datay3);

$bplot1->SetFillColor("orange");
$bplot2->SetFillColor("brown");
$bplot3->SetFillColor("darkgreen");

$gbarplot = new GroupBarPlot(array($bplot1,$bplot2,$bplot3));
$gbarplot->SetWidth(0.6);
$graph->Add($gbarplot);

$graph->Stroke();
?>

този код няма грешка и работи перфектно... проблемът ми е как мога да задам етикети за тези няколко ленти за идентифициране ...

Как мога да задам ЕТИКЕТИ..


person Robinson    schedule 22.12.2012    source източник
comment
ИЗПОЛЗВАХ ТОЗИ КОД, НО ТОЙ не работи за мен....$graph-›SetLegends(array('Pass','Fail','Not Eligble')); $графика-›Добавяне($p1);   -  person Robinson    schedule 22.12.2012
comment
може ли някой да ни помогне да разработим този код????   -  person Robinson    schedule 23.12.2012
comment
i.stack.imgur.com/Hs4hR.png искам да приложа това изображение към горната графика...мисля, че това е най-доброто решение...   -  person Robinson    schedule 23.12.2012


Отговори (1)


$graph->legend->SetPos(0.5,0.98,'center','bottom');
$bplot1->SetLegend("Pass");
$bplot2->SetLegend("---");
$bplot3->SetLegend("---");

$gbarplot = new GroupBarPlot(array($bplot1,$bplot2,$bplot3));
$gbarplot->SetWidth(0.6);
$graph->Add($gbarplot);

$graph->Stroke();

Напишете този ред във вашия код. За повече информация, моля, вижте този url:

Справочник за клас

С пример

person Syed Ahmed    schedule 23.12.2012