Jump to content

Creating bar graph using PHP (dynamic values)

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1
shakeeb.u@briskon.com

shakeeb.u@briskon.com

    Newbie

  • Members
  • Pip
  • 5 posts
Hi all,

I need to create a bar graph using php, the values of x-axis and y-axis are dynamic coming from database, Am trying my best to do it but finding it difficult. Has anyone done this or is there php library files for doing this.


Thanks,
Shakeeb

#2
BlaineSch

BlaineSch

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,448 posts
You'd simply create the image and plot the points yourself, or draw the image bring it in and draw the points.

For a bar graph... create a blank image, define a few colors, draw some rectangles based on your dynamic values output the image.

PHP has helpful examples.
PHP: imagefilledrectangle - Manual

Enjoy!

#3
shakeeb.u@briskon.com

shakeeb.u@briskon.com

    Newbie

  • Members
  • Pip
  • 5 posts

BlaineSch said:

You'd simply create the image and plot the points yourself, or draw the image bring it in and draw the points.

For a bar graph... create a blank image, define a few colors, draw some rectangles based on your dynamic values output the image.

PHP has helpful examples.
PHP: imagefilledrectangle - Manual

Enjoy!


Thank you!

#4
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
I use JavaScript and CSS for all my graphs. I've also used Google Charts.