0 Replies Latest reply on Feb 15, 2012 7:20 AM by Kuan_87

    How to create a vertical bar chart from a table? (PHP, HTML and CSS)

    Kuan_87

      Hi everyone,

       

      I have created a table and wish to proceed to do it even better in terms of analysis pattern. I want

      to create a vertical bar chart from the created table but I dunno how to start it.

       

      Here is the code for the table:

       

       

      <?php 
      
      
       $gpa11=$_REQUEST['gpa11'];
       $gpa12=$_REQUEST['gpa12'];
      
       $gpa21=$_REQUEST['gpa21'];
       $gpa22=$_REQUEST['gpa22'];
      
       $gpa31=$_REQUEST['gpa31'];
       $gpa32=$_REQUEST['gpa32'];
      
       $gpa41=$_REQUEST['gpa41'];
       $gpa42=$_REQUEST['gpa42'];
      
      
       $gpa51=$_REQUEST['gpa51'];
       $gpa52=$_REQUEST['gpa52'];
      
      
      ?>
      
      
      <!doctype html>
      <html lang="en">
         <head>
            <meta charset="utf-8">
            <meta name="viewport" content="width=1024">
            <title>Feng Mentor Mentee</title>
         </head>
      
      
         <body>
            <div id="wrapper">
               <div class="chart">
                  <h3>GPA Performance Graph</h3>
                  <table id="data-table" border="1" cellpadding="10" cellspacing="0"
                  summary="The performance of students throughout the years in university">
                     <thead>
                        <tr>
                           <td> </td>
                           <th scope="col">Year 1</th>
                           <th scope="col">Year 2</th>
                           <th scope="col">Year 3</th>
                           <th scope="col">Year 4</th>
                           <th scope="col">Year 5</th>
                        </tr>
                     </thead>
                     <tbody>
                        <tr>
                           <th scope="row">Sem 1</th>
                           <td><?php echo $gpa11;?></td>
                           <td><?php echo $gpa21;?></td>
                           <td><?php echo $gpa31;?></td>
                           <td><?php echo $gpa41;?></td>
                           <td><?php echo $gpa51;?></td>
                        </tr>
                        <tr>
                           <th scope="row">Sem 2</th>
                           <td><?php echo $gpa12;?></td>
                           <td><?php echo $gpa22;?></td>
                           <td><?php echo $gpa32;?></td>
                           <td><?php echo $gpa42;?></td>
                           <td><?php echo $gpa52;?></td>
                        </tr>
                     </tbody>
                  </table>
               </div>
            </div>
         </body>
      </html>
      

       

      Here's the look:

       

                                          
              
                 

      GPA Performance Graph

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
      Year 1Year 2Year 3Year 4Year 5
      Sem 1
      Sem 2
              
           
        

       

      Please help me on this because this is my 1st project on php.