Hi,
Ich benötige für ein Projekt einige Charts. Nach der Lektüre des Forums habe ich mir pChart angeschaut un dfür mich sehr gut befunden.
Nun soll es los gehen. Und als erstes habe ich die Erweiterung pchart1 installiert. Die Erweiterung installiert einige Fonts und PHP-Klassen.
Leider finde ich keinen Hinweis auf die Verwendung von pchart1. Wie bekomme ich meine Cahrts nun in den FE ?
Wenn man pChart runterläd und die Examples anschaut kann man dort sich einen php Skript generieren lassen, den man in seiner Seite per Insert-Tag einfügt.
PHP-Code:
<?php
include("class/pData.class.php");
include("class/pDraw.class.php");
include("class/pImage.class.php");
$myData = new pData();
$myData->addPoints(array(-23,-29,15,-25,-7,39,-5,9),"Serie1");
$myData->setSerieDescription("Serie1","Serie 1");
$myData->setSerieOnAxis("Serie1",0);
$myData->addPoints(array(8,1,-44,-16,41,-43,11,-5),"Serie2");
$myData->setSerieDescription("Serie2","Serie 2");
$myData->setSerieOnAxis("Serie2",0);
$myData->addPoints(array(39,31,48,-18,-47,-10,26,34),"Serie3");
$myData->setSerieDescription("Serie3","Serie 3");
$myData->setSerieOnAxis("Serie3",0);
$myData->addPoints(array("January","February","March","April","May","June","July","August"),"Absissa");
$myData->setAbscissa("Absissa");
$myData->setAxisPosition(0,AXIS_POSITION_LEFT);
$myData->setAxisName(0,"1st axis");
$myData->setAxisUnit(0,"");
$myPicture = new pImage(700,230,$myData);
$Settings = array("R"=>170, "G"=>183, "B"=>87, "Dash"=>1, "DashR"=>190, "DashG"=>203, "DashB"=>107);
$myPicture->drawFilledRectangle(0,0,700,230,$Settings);
$Settings = array("StartR"=>219, "StartG"=>231, "StartB"=>139, "EndR"=>1, "EndG"=>138, "EndB"=>68, "Alpha"=>50);
$myPicture->drawGradientArea(0,0,700,230,DIRECTION_VERTICAL,$Settings);
$myPicture->drawRectangle(0,0,699,229,array("R"=>0,"G"=>0,"B"=>0));
$myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>50,"G"=>50,"B"=>50,"Alpha"=>20));
$myPicture->setFontProperties(array("FontName"=>"fonts/Forgotte.ttf","FontSize"=>14));
$TextSettings = array("Align"=>TEXT_ALIGN_MIDDLEMIDDLE
, "R"=>255, "G"=>255, "B"=>255);
$myPicture->drawText(350,25,"My first pChart project",$TextSettings);
$myPicture->setShadow(FALSE);
$myPicture->setGraphArea(50,50,675,190);
$myPicture->setFontProperties(array("R"=>0,"G"=>0,"B"=>0,"FontName"=>"fonts/pf_arma_five.ttf","FontSize"=>6));
$Settings = array("Pos"=>SCALE_POS_LEFTRIGHT
, "Mode"=>SCALE_MODE_FLOATING
, "LabelingMethod"=>LABELING_ALL
, "GridR"=>255, "GridG"=>255, "GridB"=>255, "GridAlpha"=>50, "TickR"=>0, "TickG"=>0, "TickB"=>0, "TickAlpha"=>50, "LabelRotation"=>0, "CycleBackground"=>1, "DrawXLines"=>1, "DrawSubTicks"=>1, "SubTickR"=>255, "SubTickG"=>0, "SubTickB"=>0, "SubTickAlpha"=>50, "DrawYLines"=>ALL);
$myPicture->drawScale($Settings);
$myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>50,"G"=>50,"B"=>50,"Alpha"=>10));
$Config = "";
$myPicture->drawSplineChart($Config);
$Config = array("FontR"=>0, "FontG"=>0, "FontB"=>0, "FontName"=>"fonts/pf_arma_five.ttf", "FontSize"=>6, "Margin"=>6, "Alpha"=>30, "BoxSize"=>5, "Style"=>LEGEND_NOBORDER
, "Mode"=>LEGEND_HORIZONTAL
);
$myPicture->drawLegend(563,16,$Config);
$myPicture->stroke();
?>
Das habe ich gemacht und bekomme diese Meldung.
Hat jemand eien Idee oder einen Hinweis auf eine Doku wo ich nachlesen kann. Es geht erstmal darum etwas anzeigen zu können. Die Anbindung an der DB usw. werde ich später in der pCahrt Doku nachlesen. Es geht mit grundsätzlich um die Zusammenarbeiet contao<-> pchart.Code:Warning: imagettfbbox() [function.imagettfbbox]: Invalid font filename in C:\temp\xampp\htdocs\itcockpit\templates\class\pImage.class.php on line 211
#0 [internal function]: __error(2, 'imagettfbbox() ...', 'C:\temp\xampp\h...', 211, Array)
#1 C:\temp\xampp\htdocs\itcockpit\templates\class\pImage.class.php(211): imagettfbbox(14, 0, 'fonts/Forgotte....', 'My first pChart...')
#2 C:\temp\xampp\htdocs\itcockpit\templates\class\pDraw.class.php(988): pImage->getTextBox(350, 25, 'fonts/Forgotte....', 14, 0, 'My first pChart...')
#3 C:\temp\xampp\htdocs\itcockpit\templates\chart_1.php(32): pDraw->drawText(350, 25, 'My first pChart...', Array)
#4 C:\temp\xampp\htdocs\itcockpit\system\libraries\Controller.php(2215): include('C:\temp\xampp\h...')
#5 C:\temp\xampp\htdocs\itcockpit\system\modules\frontend\FrontendTemplate.php(182): Controller->replaceInsertTags('...')
#6 C:\temp\xampp\htdocs\itcockpit\system\modules\frontend\PageRegular.php(168): FrontendTemplate->output()
#7 C:\temp\xampp\htdocs\itcockpit\index.php(200): PageRegular->generate(Object(DB_Mysql_Result))
#8 C:\temp\xampp\htdocs\itcockpit\index.php(319): Index->run()
Vielen Dank!
lupo