Hi,
I like to make a nice graph based on the form input. I want to include the code from pChart (http://pchart.sourceforge.net/index.php). This code can make a image graph based on input.
The code needs 2 classes which should be included. These classes can be found in the 'pChart' subdirectory. The original code to include the classes is:
I've put all files in the directory '/pchart' under '/libraries'/. So the correct path for these classes in Joomla would be 'web-root-dir/libraries/pchart/pChart'
I read in another post that if you want to include classes you have to use the option: ( !$mainframe->isSite() ) { return; }. To check the correct path and include the classes I now use the following code:
This seems to work only it is still generating some errors about 'invalid font names' (there are fonts which are located in the '/Fonts' subdirectory). I do get an graph-image but without the corresponding text.
The question is: is this the correct use to include the code or is there an easier way which will not generate any error?
I like to make a nice graph based on the form input. I want to include the code from pChart (http://pchart.sourceforge.net/index.php). This code can make a image graph based on input.
The code needs 2 classes which should be included. These classes can be found in the 'pChart' subdirectory. The original code to include the classes is:
include("pChart/pData.class");
include("pChart/pChart.class");
I've put all files in the directory '/pchart' under '/libraries'/. So the correct path for these classes in Joomla would be 'web-root-dir/libraries/pchart/pChart'
I read in another post that if you want to include classes you have to use the option: ( !$mainframe->isSite() ) { return; }. To check the correct path and include the classes I now use the following code:
$path = JPATH_ROOT.DS.'libraries'.DS.'pchart'.DS.'pChart'.DS;
echo $path;
if ( !$mainframe->isSite() ) { return; }
require_once($path.'pData.class');
require_once($path.'pChart.class');
This seems to work only it is still generating some errors about 'invalid font names' (there are fonts which are located in the '/Fonts' subdirectory). I do get an graph-image but without the corresponding text.
The question is: is this the correct use to include the code or is there an easier way which will not generate any error?
Hi rmesman,
You only need the 'isSite' check in the Form HTML box and if you use it it should be the first line after the first <?php tag. It just stops ChronoForms trying to evaluate the form code when you save it.
I tlooks as though you may need to edit the Font paths when you call them so
You should also be careful using generic names like $path as Joomla! or ChronoForms may use them in which case you'll get unexpected results. Use $pchart_path or something like that instead.
Bob
You only need the 'isSite' check in the Form HTML box and if you use it it should be the first line after the first <?php tag. It just stops ChronoForms trying to evaluate the form code when you save it.
I tlooks as though you may need to edit the Font paths when you call them so
$Test->setFontProperties("Fonts/tahoma.ttf",8);
becomes $Test->setFontProperties($path."Fonts/tahoma.ttf",8);
You should also be careful using generic names like $path as Joomla! or ChronoForms may use them in which case you'll get unexpected results. Use $pchart_path or something like that instead.
Bob
Hi Bob,
Thanks, it works now! One other question (which may already be adressed somewhere in this forum); the code is generating a graph-image, which is being saved in a directory. Is it possible to send this image as an attachment with the e-mail (which contains the values of the form as well)?
Robin
Thanks, it works now! One other question (which may already be adressed somewhere in this forum); the code is generating a graph-image, which is being saved in a directory. Is it possible to send this image as an attachment with the e-mail (which contains the values of the form as well)?
Robin
hi rmesman,
I was wondering if you'd be interested in posting your source code for your project on this post.
I'm trying to do this as well but I'm not as savvy as some putting all of this together.
Either way, your post has pointed me in the right direction.
Thanx!
Mark
I was wondering if you'd be interested in posting your source code for your project on this post.
I'm trying to do this as well but I'm not as savvy as some putting all of this together.
Either way, your post has pointed me in the right direction.
Thanx!
Mark
Did some more hunting around regarding charts and found Google's chart API
It's super easy to use and supports dynamic values.
Check it out at http://code.google.com/apis/chart/docs/chart_wizard.html
Here's a tutorial at http://www.talkphp.com/general/1695-creating-three-dimensional-pie-chart-using-googles-chart-api.html
Totally saved my bacon...
It's super easy to use and supports dynamic values.
Check it out at http://code.google.com/apis/chart/docs/chart_wizard.html
Here's a tutorial at http://www.talkphp.com/general/1695-creating-three-dimensional-pie-chart-using-googles-chart-api.html
Totally saved my bacon...
This topic is locked and no more replies can be posted.