pchart标签和文字没有显示

时间:2014-05-30 02:15:11

标签: php codeigniter openshift pchart

到处搜索并阅读每篇帖子,但找不到匹配,所以这里是:

使用pchart库编写Codeigniter / PHP图形/图表应用程序。在Windows 7上本地工作正常,但是当我开始使用OpenShift时标签和所有文本都丢失了。图像显示正确 - 图像中没有轴标签或自由文本。

在OpenShift PHP上启用GD支持。

所有字体都在正确的位置。

Filepath变量(我正在使用“APPPATH”)测试并指向正确的位置。

所有字体应该在哪里。

帮助!

编辑:这是一些代码: 喏,给你。不确定你们是不是php或pchart专家,但是你们去了:

public function initChart($chartTitle,$chartName,$chartWidth=700, $chartHeight=250){
    require_once(APPPATH.'/libraries/pchart/class/pDraw.class.php');
    require_once(APPPATH.'/libraries/pchart/class/pImage.class.php');
    /* Create the pChart object */
    $this->pImage = new pImage($chartWidth,$chartHeight,$this->pData);

    /* Draw the background */
    $Settings = array("R"=>255, "G"=>255, "B"=>255, "Dash"=>0, "DashR"=>0, "DashG"=>0, "DashB"=>0);
    $this->pImage->drawFilledRectangle(0,0,$chartWidth,$chartHeight,$Settings);

    /* Add a border to the picture */
    $this->pImage->drawRectangle(0,0,$chartWidth-1,$chartHeight-1,array("R"=>0,"G"=>0,"B"=>0));

    /* Write the chart title */ 
    $this->pImage->setFontProperties(array("FontName"=>APPPATH."/libraries/pchart/fonts/verdana.ttf","FontSize"=>9));
    $this->pImage->drawText(230,20,$chartTitle,array("FontSize"=>16)); //,"Align"=>TEXT_ALIGN_BOTTOMMIDDLE

    /* Draw the scale and the 1st chart */
    $this->pImage->setGraphArea(60,30,$chartWidth-50,$chartHeight-60);
    $this->pImage->drawFilledRectangle(60,30,$chartWidth-50,$chartHeight-60,array("R"=>255,"G"=>255,"B"=>255,"Surrounding"=>-200,"Alpha"=>10));
    $Settings = array("Pos"=>SCALE_POS_LEFTRIGHT
        , "Mode"=>SCALE_MODE_ADDALL_START0
        , "LabelingMethod"=>LABELING_DIFFERENT
        , "LabelSkip"=>2, "GridR"=>255, "GridG"=>255, "GridB"=>255, "GridAlpha"=>50, "TickR"=>0, "TickG"=>0, "TickB"=>0, "TickAlpha"=>50, "LabelRotation"=>45, "CycleBackground"=>1, "DrawXLines"=>1, "DrawSubTicks"=>1, "SubTickR"=>255, "SubTickG"=>0, "SubTickB"=>0, "SubTickAlpha"=>50, "DrawYLines"=>ALL);
    $this->pImage->drawScale(array('LabelRotation'=>45,"GridR"=>200,"GridG"=>200,"GridB"=>200,"DrawSubTicks"=>TRUE,"Mode"=>SCALE_MODE_ADDALL_START0,"CycleBackground"=>TRUE)); //
    $this->pImage->setFontProperties(array("FontName"=>APPPATH."/libraries/pchart/fonts/verdana.ttf","FontSize"=>8));
    $this->pImage->drawLineChart(array("DisplayValues"=>FALSE,"DisplayColor"=>DISPLAY_MANUAL,"R"=>0,"G"=>0,"B"=>255,"DisplayR"=>0, "DisplayG"=>0, "DisplayB"=>255));
    $this->pImage->setShadow(FALSE);

    $this->pImage->render(APPPATH."views/images/charts/".$chartName);
}

1 个答案:

答案 0 :(得分:0)

解决了!愚蠢的错误 - 我的开发人员在代码中使用小写" fonts"指定了fonts目录,尽管目录并不总是以这种方式创建的。然后使用git就不可能" mv"来自" Fonts"的目录to" fonts"因为git不区分大小写。必须将其移动到占位符名称,然后将其移动到" fonts"