Forum Moderators: coopster

Message Too Old, No Replies

Php Dynamic Chart

Dynamic PHP Chart

         

xa3021

4:47 am on Jan 22, 2008 (gmt 0)

10+ Year Member



I need help with a php script that would make a horizontal chart showing 2 lines for each date. I would prefer it too create a jpg or png out of the chart. I actually have one working here...<snip> That is using the script from <snip> and its a good script but I can get it to add values from my database. Please help ASAP. If you need anymore information please feel free to contact me.

[edited by: eelixduppy at 7:12 am (utc) on Jan. 22, 2008]
[edit reason] removed URLs [/edit]

coopster

3:22 pm on Jan 22, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Can't you just replace the working copy of your code with the values from your database? What part are you struggling with? Retrieving data from your database tables?

xa3021

5:17 pm on Jan 22, 2008 (gmt 0)

10+ Year Member



The system Im building you are capable of adding a weekly count to keep track of the growth of the church and everything is stored in mysql. So I need it to graph the previous weeks along with any new added weeks. If I went in to change it all the time it would take forever for all the sites Im doing....wouldnt be worth it. I just need it to pull,say, the last 8 counts that were entered into the database and graph them. Please let me know what you think...I know it can be done. Ive seen it somewhere just cant remember where...Thanks!

coopster

6:47 pm on Jan 22, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



You can always use markup (CSS) to render a bar graph. But we still don't know what your issue is? Do you not know how to get the data from your database table?

xa3021

8:47 pm on Jan 22, 2008 (gmt 0)

10+ Year Member



Yeah...I just need help getting the values into the graph. I can do a css graph as long as it can dynamically change accordingly to the php data. I can also use javascript if you think it would be easier to get the data from the mysql and then run it through css or javascript or whatever and then display a graph. So please help me get the data from mysql and display it in a graph....thank you in advance.

coopster

9:20 am on Jan 23, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



There is a thread in the PHP Forum Library [webmasterworld.com] that describes the Basics of extracting data from MySQL [webmasterworld.com] to get you started.

maxximus

9:54 am on Jan 23, 2008 (gmt 0)

10+ Year Member



You can use Googles chart API. [code.google.com...]

Just use the Google URL as your image source and substitute your data from the DB.

Example below of bar chart over 8 weeks.

Google api [chart.apis.google.com]