Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Regular Coder
    Join Date
    Oct 2011
    Posts
    113
    Thanks
    9
    Thanked 1 Time in 1 Post

    Making a Graph with my current data

    Hello,

    I currently want to make a graph with my data in my database. My template already comes with the graph. This is the data I have :



    This is the Graph.
    I want to have every hour on the bottom , and the amount of rows in that hour on the side.



    Here is the graph code:
    PHP Code:
    <table id="graph-data" class="graph">
                                    <
    caption>2009 Employee Sales by Department</caption>
                                    <
    thead>
                                        <
    tr>
                                            <
    td></td>
                                            <
    th scope="col">food</th>
                                            <
    th scope="col">auto</th>
                                            <
    th scope="col">household</th>
                                            <
    th scope="col">furniture</th>
                                            <
    th scope="col">kitchen</th>
                                            <
    th scope="col">bath</th>
                                        </
    tr>
                                    </
    thead>
                                    <
    tbody>
                                        <
    tr>
                                            <
    th scope="row">Mary</th>
                                            <
    td>190</td>
                                            <
    td>160</td>
                                            <
    td>40</td>
                                            <
    td>120</td>
                                            <
    td>30</td>
                                            <
    td>70</td>
                                        </
    tr>
                                        <
    tr>
                                            <
    th scope="row">Tom</th>
                                            <
    td>3</td>
                                            <
    td>40</td>
                                            <
    td>30</td>
                                            <
    td>45</td>
                                            <
    td>35</td>
                                            <
    td>49</td>
                                        </
    tr>
                                        <
    tr>
                                            <
    th scope="row">Brad</th>
                                            <
    td>10</td>
                                            <
    td>180</td>
                                            <
    td>10</td>
                                            <
    td>85</td>
                                            <
    td>25</td>
                                            <
    td>79</td>
                                        </
    tr>
                                        <
    tr>
                                            <
    th scope="row">Kate</th>
                                            <
    td>40</td>
                                            <
    td>80</td>
                                            <
    td>90</td>
                                            <
    td>25</td>
                                            <
    td>15</td>
                                            <
    td>119</td>
                                        </
    tr>        
                                    </
    tbody>
                                </
    table

    Help is much appreciated... Thanks!

  • #2
    Regular Coder
    Join Date
    Oct 2011
    Posts
    113
    Thanks
    9
    Thanked 1 Time in 1 Post
    Hello,

    Is anyone able to help
    ?


  • #3
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    Does it use HTML to generate that graph? The image appears to be an image of a graph but I don't see any GD manipulations here.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  • #4
    Regular Coder
    Join Date
    Oct 2011
    Posts
    113
    Thanks
    9
    Thanked 1 Time in 1 Post
    Uhh yea I just want to know how to make it dynamic. The graph uses a ton of other stuff I just need to know how to make the graph with the DB data I have

  • #5
    Regular Coder
    Join Date
    Oct 2011
    Posts
    113
    Thanks
    9
    Thanked 1 Time in 1 Post
    Please

  • #6
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    Well not really. If you just need to build an HTML table simply query out what you need. Hour by hour would require you to aggregate it in some fashion, but since you provide no information to the meaning of any of this data, its hard to say what to do with it. Sounds like you simply need to pull the count and the HOUR of the timestamp, but it would only hold value if you group it by something (the HOUR perhaps?), and you give it a date range to look in.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  • #7
    Senior Coder
    Join Date
    Sep 2010
    Posts
    2,085
    Thanks
    15
    Thanked 245 Times in 245 Posts
    PhP works very well with ,svg files. You can use it to make all kinds of graphs and other presentations dynamically. You can use the PhP download dialog to download the .svg file or something like ImageMagick to convert to a .png or other more common graphic format as part of the download dialog.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •