0

到处搜索并阅读有关此的所有帖子,但找不到匹配项,所以这里是:

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

在 OpenShift PHP 上启用了 GD 支持。

字体都在正确的地方。

文件路径变量(我使用的是“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);
}
4

1 回答 1

0

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

于 2014-06-05T01:21:17.700 回答