我正在尝试命名我的x轴(见图)。

如您所见,没有打印x轴名称。但是,由于以下这一行,我的代码应该打印一个:$MyData->setSerieDescription("Labels","Range of Data");,除非我误解了用法。
码:
/* pChart library inclusions */
include("../class/pData.class.php");
include("../class/pDraw.class.php");
include("../class/pImage.class.php");
/* Create and populate the pData object */
$MyData = new pData();
$MyData->addPoints(array($LT50,$GT50_LT100,$GT100_LT150,$GT150_LT200,$GT200_LT250,$GT250_LT300,$GT300_LT350,$GT350_LT400,$GT400_LT450,$GT450),"Probe 3");
$MyData->setSerieWeight("Probe 3",2);
$MyData->setAxisName(0,"Number of Occurrences");;
$MyData->addPoints(array("Diff < 50","50 > Diff < 100","100 > Diff < 150","150 > Diff < 200","200 > Diff < 250","250 > Diff < 300","300 > Diff < 350", "350 > Diff < 400", "400 > Diff < 450", "Diff > 450"),"Labels");
$MyData->setSerieDescription("Labels","Range of Data");
$MyData->setAbscissa("Labels");
/* Create the pChart object */
$myPicture = new pImage(1500,690,$MyData);
/* Turn of Antialiasing */
$myPicture->Antialias = FALSE;
/* Add a border to the picture */
$myPicture->drawRectangle(0,0,1440,675,array("R"=>0,"G"=>0,"B"=>0));
/* Write the chart title */
$myPicture->setFontProperties(array("FontName"=>"../fonts/Forgotte.ttf","FontSize"=>20));
$myPicture->drawText(250,35,"Time Diff Between TRWire Job Created and Crew Dispatched",array("FontSize"=>15,"Align"=>TEXT_ALIGN_BOTTOMMIDDLE));
/* Set the default font */
$myPicture->setFontProperties(array("FontName"=>"../fonts/pf_arma_five.ttf","FontSize"=>10));
/* Define the chart area */
$myPicture->setGraphArea(60,40,1400,600);
/* Draw the scale */
$AxisBoundaries = array(0=>array("Min"=>0,"Max"=>$max));
$scaleSettings = array("Mode"=>SCALE_MODE_MANUAL, "LabelRotation"=>30, "ManualScale"=>$AxisBoundaries, "XMargin"=>10,"YMargin"=>10,"Floating"=>TRUE,"GridR"=>200,"GridG"=>200,"GridB"=>200,"DrawSubTicks"=>TRUE,"CycleBackground"=>TRUE );
$myPicture->drawScale($scaleSettings);
/* Turn on Antialiasing */
$myPicture->Antialias = TRUE;
/* Draw the line chart */
$myPicture->drawLineChart();
/* Render the picture (choose the best way) */
$myPicture->autoOutput("./pChart/examples/pictures/example.drawLineChart.simple.png");
Run Code Online (Sandbox Code Playgroud)
小智 5
这个问题困扰了我。我很晚才起床,诊断只是让我的图表显示出来。
与缺少的X轴标题相关,我终于发现在源目录中使用$myData->setAbscissaName("Time of Reading");grepping对我有用。太神奇了。
他们的文档很差。我什至复制并粘贴了带有标题x轴的示例脚本(该脚本在复制和粘贴时从未起作用),结果它们也没有标题。非常烦躁。
| 归档时间: |
|
| 查看次数: |
2690 次 |
| 最近记录: |