我正在尝试使用透明背景来创建折线图,但到目前为止,我只能将背景设置为特定颜色。由于它是PNG,但它应该可以。
$linePlot = new LinePlot($plotData);
$linePlot->SetFillColor('#61a9f3@.6');
$graph = new Graph(300, 100);
$graph->SetScale('intint');
$graph->SetAlphaBlending();
$graph->SetMarginColor('black:1');
$graph->SetFrame(true,'black', 0);
$graph->Add($linePlot);
$graph->Stroke();
结果
不透明,但黑色
答案 0 :(得分:1)
对我来说,我必须把黑色而不是白色才能获得透明度!
$graph->SetMarginColor('black:0');
$graph->SetFrame(true,'black:0', 1); //but this make labels/letters weird !!!
$graph->img->SetTransparent('black');
现在,在图片中制作多个图表时,这不起作用。我尝试为每个图形制作透明度或最终的(mgraph),我得到'HTTP ERROR 500'(内部服务器!?!)
答案 1 :(得分:0)
$graph->SetTheme($theme_class);
$graph->img->SetAntiAliasing(false);
$graph->title->Set('Filled Y-grid');
$graph->SetMarginColor('White:0.6');
$graph->SetFrame(true,'White:0.6',1); // The '1' here seems to be irrelevant
// I've tried much larger numbers with no
// change. This is supposed to be frame
// width (in pixels).
$graph->SetBox(false);
答案 2 :(得分:0)
透明PNG图片: $ graph-> img-> SetTransparent(“white”); 效果很好!!!