使用JPGraph和php,输出折线图,专门做了一个函数生成折线图。在外面传递一个数组给这个函数,其中$value[3]表示的是颜色,可以按$value[3]给的属性显示正确的颜色,但是SetColor却不好使。第一条折线的颜色总是蓝色,第二条总是红色,之后是绿色和黄色。无论怎么改都是这样。实在不知道怎么办了,请高手帮着看看。代码片段如下:$graph = new graph(800,500);
$graph ->setscale("textlin");
$graph ->setshadow();
    
$graph ->setmargin(40,10,80,10);
$graph ->title->set($this->imgTitle);
        
$graph->title->setfont(FF_PGOTHIC,FS_NORMAL);
       
foreach ($this->arrData as $value) {      $lineplot1=new lineplot($value[2]);
      $lineplot1->SetColor($value[3]);
      $lineplot1->setlegend($value[0]);
            
      $lineplot1->->SetType($value[1]);
      $lineplot1->->SetFillColor($value[3]);
      $lineplot1->->SetWidth(4);
            
      $graph->add($lineplot1);
      $lineplot1=null;
            
}
$graph->legend->setlayout(LEGEND_HOR);
$graph->legend->pos(0.5,0.05,"center","right");
$graph->legend->SetFont(FF_PGOTHIC,FS_NORMAL);
        
$graph->StrokeCSIM();另外,运行JPGraph中给的例子:linegraceex.php,代码如下:<?php // content="text/plain; charset=utf-8"
require_once ('jpgraph/jpgraph.php');
require_once ('jpgraph/jpgraph_line.php');$datay = array(0.2980,0.3039,0.3020,0.3027,0.3015);$graph = new Graph(300,200);
$graph->img->SetMargin(40,40,40,40); $graph->img->SetAntiAliasing();
$graph->SetScale("textlin");
$graph->SetShadow();
$graph->title->Set("Example of 10% top/bottom grace");
$graph->title->SetFont(FF_FONT1,FS_BOLD);// Add 10% grace to top and bottom of plot
$graph->yscale->SetGrace(10,10);$p1 = new LinePlot($datay);
$p1->SetColor("blue");
$p1->->SetType(MARK_FILLEDCIRCLE);
$p1->->SetFillColor("blue");
$p1->->SetWidth(4);$p1->SetCenter();
$graph->Add($p1);$graph->Stroke();其中SetColor改为red,依然显示蓝色,改为red,可以正常显示。和我写的代码出现的问题是一样的。我用的JPGraph是目前最新的版本jpgraph-3.5.0b1.tar.gz。phpjpgraph