1

我想使用 Pchart 制作温度线图。
我需要的是正温度是红色,负温度是蓝色。
关于如何实现这种效果的任何想法?

4

1 回答 1

0

在 pChart 示例中,请参阅页面 [Examples > Area Chart > drawAreaChart.threshold]。 带有阈值着色的 drawAreaChart 的 pGraph 文档示例的屏幕截图 如果区域的某些部分(在区域图中)在您配置的阈值之内,这确实会使它们着色。

该示例中的代码片段:

/* Draw the area chart */
$Threshold = "";
$Threshold[] = array("Min"=>0,"Max"=>5,"R"=>187,"G"=>220,"B"=>0,"Alpha"=>100);
$Threshold[] = array("Min"=>5,"Max"=>10,"R"=>240,"G"=>132,"B"=>20,"Alpha"=>100);
$Threshold[] = array("Min"=>10,"Max"=>20,"R"=>240,"G"=>91,"B"=>20,"Alpha"=>100);
$myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>20));
$myPicture->drawAreaChart(array("Threshold"=>$Threshold));

这种高于/低于阈值的着色在面积图中是可能的。我怀疑这适用于折线图,但值得一试..

它也可以用水平线表示阈值,同样来自这个例子:

/* Write the thresholds */
$myPicture->drawThreshold(5,array("WriteCaption"=>TRUE,"Caption"=>"Warn Zone","Alpha"=>70,"Ticks"=>2,"R"=>0,"G"=>0,"B"=>255));
$myPicture->drawThreshold(10,array("WriteCaption"=>TRUE,"Caption"=>"Error Zone","Alpha"=>70,"Ticks"=>2,"R"=>0,"G"=>0,"B"=>255));

顺便说一下,线(非区域)图支持此阈值虚线。

于 2013-02-27T14:24:31.597 回答