[SOLVED] Creating dynamic graphs

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

[SOLVED] Creating dynamic graphs

Post by Burrito »

I'm certain that php must have some kind of graphing capability but I know nothing about it.

Cold Fusion has a nice little tag called <cfgraph> which can create dynamic graphs (bar, line, pie....mmm pie).

Here's what I need:

I have a table that is tracking information about when a form is being filled out online. My people here want to see a graph that will display the peak hours of when the form is being filled out.

I'm just using a timestamp on my form action page to capture when it was submitted so I'll just need to do a count between certain ranges (hours, minutes..whatever), but how can I put that data into a nice little graph?

please advise...btw, I alraedy have GD enabled on the server so don't let be a stumbling block in your answer (assuming I"m going to need some GD to do this). 8O
Last edited by Burrito on Tue Apr 19, 2005 12:45 pm, edited 3 times in total.
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

User avatar
phpScott
DevNet Resident
Posts: 1206
Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.

Post by phpScott »

quick google search revealed
http://www.builderau.com.au/webdev/scri ... 455,00.htm
looks like a good start after skimming it.

lots of tut's and docs online on how to use php and the gd2 lib.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

JPGraph is the best PHP graphing library that I've found. The documentation is a bit tricky, but it's still pretty easy.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

yes pickle, I found that earlier today and have been playing with it all day. So far I've created some pretty good stuff. But as you mentioned, the docs are tough to plow through and not super intuitive. Fortunately, there are some good examples (that are decently commented) to assist.

thx everyone for the responses...jpgraph is what I'm going to use.

Burr
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

ok, just ran into to somethign that I think is kinda weird and not so good with jpgraph.

I set it to generate jpg files (which it seems to be doing), but when I rt click and save image as, it only offers to save it as a bmp file??? when I save the file, it's over 600K. I'm pretty sure it really is a jpg because it looks like a poor quality jpg image, but it saves it as a bmp (a very large one) and when I open it with my image viewer, it opens just fine (as a bitmap).

any ideas here?

I can't be having 600K images...
User avatar
vigge89
Forum Regular
Posts: 875
Joined: Wed Jul 30, 2003 3:29 am
Location: Sweden

Post by vigge89 »

Burrito wrote:ok, just ran into to somethign that I think is kinda weird and not so good with jpgraph.

I set it to generate jpg files (which it seems to be doing), but when I rt click and save image as, it only offers to save it as a bmp file??? when I save the file, it's over 600K. I'm pretty sure it really is a jpg because it looks like a poor quality jpg image, but it saves it as a bmp (a very large one) and when I open it with my image viewer, it opens just fine (as a bitmap).

any ideas here?

I can't be having 600K images...
Known problem ;) :
http://support.microsoft.com/default.as ... -us;810978
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

hmm....thanks for the link, I tried what it suggested and still having the same problem. I don't really care so much if I can't d/l the file what I'm concerned about is the image size. I tried it in FF and low and behold, the images size is really only 30K. I assume that is the same for IE?

thanks again.

Burr
User avatar
vigge89
Forum Regular
Posts: 875
Joined: Wed Jul 30, 2003 3:29 am
Location: Sweden

Post by vigge89 »

Burrito wrote:hmm....thanks for the link, I tried what it suggested and still having the same problem. I don't really care so much if I can't d/l the file what I'm concerned about is the image size. I tried it in FF and low and behold, the images size is really only 30K. I assume that is the same for IE?

thanks again.

Burr
Yes, that's right :)
Doesn't matter which browser you're using, the image is still the same image ;)
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

I've had this problem in the past and usually it's because the headers aren't being sent properly. Consequently, IE just defaults to BMP.

If you're having trouble with JPgraph specifically, I'd suggest using their forums. They are extremely helpful and if you're problem is technical enough, there's a good chance you'll get a message from the programmer himself.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

there's actually a very simple fix for it in IE.. If you send the Content-length header, they work perfectly.. last time I had to deal with it anyways.
Post Reply