Jul
30

php JPGRAPH

//设置图列的数据

$bplot1 = new BarPlot($datay1);

$bplot2 = new BarPlot($datay2);

//设置图列的填充颜色

$bplot1->SetFillColor('orange@0.4');

$bplot2->SetFillColor('brown@0.4');

设置值的格式

$bplot1->value->SetFormat('%d');

//设置图列标签

$bplot1->SetLegend('Label 1');

$bplot2->SetLegend('Label 2');

//设置图列在图中的阴影

$bplot1->SetShadow('black@0.4');

$bplot2->SetShadow('black@0.4');

//生成图列

$gbarplot = new GroupBarPlot(array($bplot1,$bplot2));

$gbarplot->SetWidth(0.9);

$graph->Add($gbarplot);

//生成图形

$graph->Stroke();

//上面所说的时在生成柱形图,当生成线性图时用下面的方法

$p1 = new LinePlot($datay);

$p1->mark->SetType(MARK_FILLEDCIRCLE);

$p1->mark->SetFillColor("red");

$p1->mark->SetWidth(4);

$p1->SetColor("blue");

$p1->SetCenter();

$p1->SetLegend("Triumph Tiger -98");

$graph->Add($p1);

$p2 = new LinePlot($data2y);

$p2->mark->SetType(MARK_STAR);

$p2->mark->SetFillColor("red");

$p2->mark->SetWidth(4);

$p2->SetColor("red");

$p2->SetCenter();

$p2->SetLegend("New tiger -99");

$graph->Add($p2);

// Style can also be specified as SetStyle([1|2|3|4]) or
// SetStyle("solid"|"dotted"|"dashed"|"lobgdashed")
$lineplot->SetStyle("dashed");//设置线的样式

$graph->yaxis->scale->SetGrace(20); //设置y轴更优美一些

共计 0 条评论

NAME:

required

E-MAIL:

required, will not be published

HOMEPAGE:

CONTENT: