[英]Transparent background in jpGraph
我正在尝试实现具有透明背景的折线图,但是到目前为止,我只能将背景设置为特定的颜色。 由于它是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();
结果
不透明,但黑色
对我来说,我必须用黑色代替白色来获得透明度!
$graph->SetMarginColor('black:0');
$graph->SetFrame(true,'black:0', 1); //but this make labels/letters weird !!!
$graph->img->SetTransparent('black');
现在,在图片中制作多个图形时,这将不起作用。 我尝试为每张图都设置透明性或使最后一张图(mgraph)透明,然后得到“ HTTP ERROR 500”(内部服务器!!!)
$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);
参考: 更改jpgraph的页边距颜色
透明的PNG图片: $ graph-> img-> SetTransparent(“ white”); 很棒!!!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.