pChart 2.x forum http://wiki.pchart.net/forum/ |
|
pChart and Codeigniter http://wiki.pchart.net/forum/viewtopic.php?f=1&t=440 |
Page 1 of 1 |
Author: | gavinwerner [ Wed May 04, 2011 9:34 am ] |
Post subject: | pChart and Codeigniter |
Hi, I am trying to use the pChart libraries in a Codeigniter controller. I copied pChart2.1.1 to the ../application/libraries folder then added the following lines to the constructor in the controller: $this->load->library('pChart2.1.1/class/pData'); $this->load->library('pChart2.1.1/class/pDraw'); $this->load->library('pChart2.1.1/class/pImage'); (note I removed the .class from the file names to make it compatible with the codeigniter convention) However when I try to instantiate one of them the code hangs. i.e. $MyData = new pData(); Any ideas as to why? I'd be grateful for any input. Thanks, Gavin |
Author: | gavinwerner [ Wed May 04, 2011 10:39 am ] |
Post subject: | Re: pChart and Codeigniter |
Okay got past that hurdle by including the pChart classes from the view using include() as per the pChart examples. However now I'm getting these errors: A PHP Error was encountered Severity: Warning Message: imagettfbbox() [function.imagettfbbox]: Could not find/open font Filename: class/pImage.class.php Any ideas? |
Author: | dsimpson [ Sat May 07, 2011 6:11 am ] |
Post subject: | Re: pChart and Codeigniter |
Gavin, I am writing a CakePHP code generator which builds the code to create pChart charts - and I have seen similar errors. But usually, these errors don't affect the chart output. A few things I can think of: 1) CakePHP has a debug setting. I don't know if CodeIgniter has this feature, but if so, turn it off. You don't want errors to get sent out to the web browser before the image headers get sent. 2) Make sure that your font name paths refer to a file which actually exists. I have an option to set all of my fonts to Verdana by default to prevent missing font issues in my generated code. So you will want to check the exact font name, and make sure that it actually exists. And then also check the precise path to make sure that it can be found. pChart doesn't have a default fallback font name, so if you use the wrong path, or the wrong filename, the text will just simply not get displayed. And you would expect to see an error similar to what you have reported. |
Author: | sidkdbl07 [ Wed May 18, 2011 12:42 am ] |
Post subject: | Re: pChart and Codeigniter |
try including the full path to the font path Code: $myPicture->setFontProperties(array(...,"FontName"=>"/full/path/to/Font.ttf",...); |
Author: | xorman [ Sat Jun 11, 2011 2:19 am ] |
Post subject: | Re: pChart and Codeigniter |
hello gavin, i'm having trouble making codeigniter and pchart work. would appreciate if you would share your knowledge. i'm new to codeigniter so some detail level tips will be helpful. thanks |
Author: | sidkdbl07 [ Thu Jun 23, 2011 6:23 pm ] |
Post subject: | Re: pChart and Codeigniter |
xorman, Post some code and we can all have a go at helping you. |
Author: | cbaldinu [ Thu Jul 19, 2012 12:45 pm ] |
Post subject: | Re: pChart and Codeigniter |
Hi all, i was trying to get pChart work with Codeigniter.. Here are some stuff i did: CLASS PDATA : Code: class CI_Pdata CLASS PIMAGE : Code: include('Pdraw.php'); class CI_Pimage extends CI_Pdraw CLASS PDRAW : Code: class CI_Pdraw i left everything as it is. After this, on my controller : Code: $this->load->library('class/pdata'); $this->load->library('class/pimage'); $this->load->library('class/pdraw'); $PDA =& $this->pdata; $PDB =& $this->pimage; $PDA->addPoints(array(VOID,3,4,3,5)); $PDB->pImage(700,230, $PDA); $PDB->setFontProperties(array("FontName"=>"../fonts/Forgotte.ttf","FontSize"=>11)); $PDB->setGraphArea(60,40,670,190); $PDB->drawScale(); $PDB->drawSplineChart(); $PDB->stroke(); The result is that i have no errors, but i can't display the image. I was thinking this can be because of the font, but i am not sure of this. I have tried to put the full path to the SetFontProperties, but with no acceptable results, it still gives me the symbol of the image broken. I think i have reached a good goal, but i am not able to go forward. Can someone help me with this trouble? Thanks in advance, Cristian Baldinu |
Page 1 of 1 | All times are UTC |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |