PHP graphs and charts from a form

Need help with Photoshop, the GIMP, Illustrator, or others? Want to show off your work? Looking for advice on your newest Flash stuff?

Moderator: General Moderators

Post Reply
podarum
Forum Commoner
Posts: 51
Joined: Mon Jun 15, 2009 1:36 pm

PHP graphs and charts from a form

Post by podarum »

I'm very very new to php so please help me out. I've created a form on my site that requires a users inputs... I've created an output site in php with calculations of the users inputs but I also want to show the output with charts and graphs among text, for example a chart of how a user's age (let's just say) compares to a pool of other ages... Does anyone know how I can achieve this and using what program if there is one... Thanks
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: PHP graphs and charts from a form

Post by pickle »

jpGraph and pChart are two popular PHP graphing libraries.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
make.rohit
Forum Newbie
Posts: 2
Joined: Mon Jul 13, 2009 6:37 am

Re: PHP graphs and charts from a form

Post by make.rohit »

hello,

you might just want to have a look at FusionCharts at http://www.fusioncharts.com or FusionCharts Free at http://www.fusioncharts.com/free. They integrate very well with PHP using their native PHP API and offer nice charting options. If you face any problems, I'll be glad to help.

thanks
Rohit
podarum
Forum Commoner
Posts: 51
Joined: Mon Jun 15, 2009 1:36 pm

Re: PHP graphs and charts from a form

Post by podarum »

Ok, I downloaded FusionCharts and installed it... now O can't get it to run with users's data from a from..for example if a customer inputs variableA=100 and variableB=45, I get a percentage 45/100 = 45%, I want to show a pie chart wiht 45% and 55%, but it looks like it only takes data from mySQL..
make.rohit
Forum Newbie
Posts: 2
Joined: Mon Jul 13, 2009 6:37 am

Re: PHP graphs and charts from a form

Post by make.rohit »

Hi Podarum,

It appears from their documentation that FusionCharts works only with XML data. So you need to convert data to FusionCharts XML format which you are taking input from a form. They have an example for the same at FusionCharts_Evaluation/Code/PHPClass/FormBased location.
Check it out.
Simnia
Forum Newbie
Posts: 9
Joined: Tue Jul 07, 2009 5:37 pm

Re: PHP graphs and charts from a form

Post by Simnia »

I also need graphics in my PHP program, so I took the advice given in this thread and immediately ran into problems that seem insurmountable:

(1) jpGraph
http://www.aditus.nu/jpgraph/
Their downloaded file is in TAR format, I had to struggle with first downloading the installing 7-Zip to unzip it, I believe it required two separate unzips, for some reason, then I got a file broken message when I tried to unzip it, despite it having been posted on their site just a few days ago. I notified the company but they're in Sweden, and I couldn't attach a screen snap of their error because they force responses via an e-mail service that doesn't disclose their e-mail address.

(2) pChart
http://pchart.sourceforge.net/
http://pchart.sourceforge.net/documentation.php
None of the two sample code pieces I used that they posted would work at all. The links aren't recognized. I can't tell if GD library is installed, despite my installing it 2-3x. The line that needs to be uncommented is already uncommented, so their only FAQ regarding their program not working is useless. Their documentation is absolutely filled with misspellings and grammatical errors. I don't have a clue what is wrong, and I can't figure out from their documentation how to get anything working. Do I need to use a special path? Include a special command in my code? Install something else? Did I install it too many times? I have no idea and their documentation is of no help, as far as I can see.

I'll try the other code somebody suggested in this thread, since the two programs I mentioned seemed to be total dead ends.
Attachments
unopen_error.jpg
unopen_error.jpg (113.82 KiB) Viewed 8746 times
unzip_error.jpg
unzip_error.jpg (32.18 KiB) Viewed 8750 times
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: PHP graphs and charts from a form

Post by pickle »

There's nothing wrong with a TAR file. It's a pretty standard compression format. Download WinRar to uncompress it.

Create a page that has just:

Code: Select all

<?PHP
phpinfo();
?>
in it. That'll tell you if GD is installed.

Both these libraries are very popular. I would be genuinely surprised if your problems are due to the libraries, and not to your setup/how you're trying to use them.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply