Creating a graph dynamically

Discussion in 'Programming' started by projectWORD, Jul 26, 2008.

  1. #1
    Hi,
    What is the best way to create a graph using data I collect. A basic graph date against votes. I want it to be custom.

    I work with PHP and Javascript. Graph will be built from database information.

    Any ideas?
     
    projectWORD, Jul 26, 2008 IP
  2. Trusted Writer

    Trusted Writer Banned

    Messages:
    1,370
    Likes Received:
    52
    Best Answers:
    0
    Trophy Points:
    160
    #2
    Trusted Writer, Jul 26, 2008 IP
  3. klimu

    klimu Peon

    Messages:
    21
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Two that I can think of Jpgraph and PHP/SWF charts (cant use links yet, so search for them yourself)
     
    klimu, Jul 28, 2008 IP
  4. perlbone

    perlbone Peon

    Messages:
    128
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I prefer to do some charts with Dojo if there's a need of cheap yet good Javascript solution (that is a refurbished Plotkit, basically), and it's easy enough to create derivative works.

    dojocampus.org/explorer/#Dojox_Charting

    Also if you dare, you can write a small SVG/VML/JScript(Canvas) cross-platform tookit by yourself and render all your pages via SVG.

    Also, for static charts there's nothing better but to draw the chart at server's side once it's required, don't forget it... *sceptically thinks on GD and gradients rendering*
     
    perlbone, Jul 28, 2008 IP
  5. rohan_shenoy

    rohan_shenoy Active Member

    Messages:
    441
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    60
    #5
    You will need to use PHP's GD library(image functions). You may need to learn the following functions atleast:
    1. imagecreate()
    2. imagefilledrectangle() for bar diagrams or imageline() for linked points or imagepolygon() for polygon!
    3. imagejpeg() or imagepng() [or some other function to output image]
    4. imagedestroy()

    How you use them is upto you! ;)
     
    rohan_shenoy, Jul 28, 2008 IP