View unanswered posts | View active topics It is currently Thu Mar 28, 2024 7:34 pm



Reply to topic  [ 7 posts ] 
pChart and Codeigniter 
Author Message
New pChart user
New pChart user

Joined: Wed May 04, 2011 8:51 am
Posts: 2
Post 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


Wed May 04, 2011 9:34 am
Profile
New pChart user
New pChart user

Joined: Wed May 04, 2011 8:51 am
Posts: 2
Post 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?


Wed May 04, 2011 10:39 am
Profile
New pChart user
New pChart user

Joined: Wed Apr 06, 2011 8:42 pm
Posts: 3
Post 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.

_________________
David Simpson
http://www.fmpromigrator.com


Sat May 07, 2011 6:11 am
Profile
Experienced pChart user
Experienced pChart user

Joined: Wed Dec 22, 2010 9:00 pm
Posts: 30
Post Re: pChart and Codeigniter
try including the full path to the font path
Code:
$myPicture->setFontProperties(array(...,"FontName"=>"/full/path/to/Font.ttf",...);


Wed May 18, 2011 12:42 am
Profile
New pChart user
New pChart user

Joined: Sat Jun 11, 2011 2:15 am
Posts: 1
Post 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


Sat Jun 11, 2011 2:19 am
Profile
Experienced pChart user
Experienced pChart user

Joined: Wed Dec 22, 2010 9:00 pm
Posts: 30
Post Re: pChart and Codeigniter
xorman,

Post some code and we can all have a go at helping you.


Thu Jun 23, 2011 6:23 pm
Profile
Regular pChart user
Regular pChart user

Joined: Fri Apr 20, 2012 10:15 am
Posts: 9
Post 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


Thu Jul 19, 2012 12:45 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 7 posts ] 

Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron