Jump to content

Using Graphs in a PHP app


dennis-fedco

Recommended Posts

I have some data that I need to have visualized using 2D graphs.

 

Looking around I see various tools available, in various technology flavors:

  • JS:  Google Charts, Flot, HighCharts
  • PHP:  phpCharts, pCharts, JpGraph

Question I am trying to decide is -- do i want to use JS, or do I want to use PHP.

Can someone please share some insight, provide some ideas, maybe shed some things I didn't think about, to help me consider choosing between these technologies?

 

EDIT (thoughts):  It seems and I think that JS technology is a bit more "polished" when it comes to graphing, and perhaps has a larger following, and perhaps is a bit more "dynamic" than similar packages done in PHP.  On the PHP side, JpGraph is not being mantained :( but other packages are still in a reasonable condision I think.  Is that enough to go with JS? 

 

Another area is that JS is client-side only really, so it may be hard to integrate it with anything server-side.  aka, it's hard to "call back home" for data for example, so you have to establish all data upfront, when in PHP while on the server side, you can freely call Database as-you-go.

Edited by dennis-fedco
Link to comment
Share on other sites

Another area is that JS is client-side only really, so it may be hard to integrate it with anything server-side.  aka, it's hard to "call back home" for data for example, so you have to establish all data upfront, when in PHP while on the server side, you can freely call Database as-you-go.

 

You could look into using Ajax to connect your JavaScript chart(s) to a database.

 

For what it's worth, I currently use a JavaScript solution called amCharts. I don't have any great reasons for using the solution other than it was simple enough to figure out and it met my needs.

 

 

I haven't spent that much time looking into the solutions mentioned, but phpCharts appears to create a JavaScript chart:

http://phpchart.org/examples/line-bar-pie-charts/#prettyPhoto/0/

 

pChart seems interesting. The examples I've seen on their website are all images which look pretty good. Do you know if that's actual output or does pChart display the chart in some other fashion such as JavaScript? If pChart only produces images, one possible downfall of the solution is that you lose the interactivity that JavaScript solutions provide.

Edited by cyberRobot
Link to comment
Share on other sites

I usually produce my own "hand-rolled" charts. As production of a chart usually requires data from a DB server I produce them server-side using PHP, either as an image or using vector graphics. Producing them on the server with PHP does not preclude interaction with the user. If I require an interactive chart then I use SVG which allows me to assign mouse events to the various graphic elements (eg rectangles, circles). Of course you can make an image interactive with an image map but SVG makes it a lot easier.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.