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 4 of 4
  1. #1
    New Coder
    Join Date
    Jan 2011
    Posts
    92
    Thanks
    8
    Thanked 0 Times in 0 Posts

    generating graph using static data

    Hello,

    I want to generate a graph for my static data.
    My code is like this. As i am very new, i do not know how to do it.
    please someone suggest me

    I have copied the code from Google Charts

    Code:
    <html>
      <head>
        <script type="text/javascript" src="https://www.google.com/jsapi"></script>
        <script type="text/javascript">
          google.load("visualization", "1", {packages:["corechart"]});
          google.setOnLoadCallback(drawChart);
          function drawChart() {
            var data = google.visualization.arrayToDataTable([
              ['Task', 'Hours per Day'],
              ['Work',     11],
              ['Eat',      2],
              ['Commute',  2],
              ['Watch TV', 2],
              ['Sleep',    7]
            ]);
    
            var options = {
              title: 'My Daily Activities'
            };
    
            var chart = new google.visualization.PieChart(document.getElementById('chart_div'));
            chart.draw(data, options);
          }
        </script>
      </head>
      <body>
        <div id="chart_div" style="width: 900px; height: 500px;"></div>
      </body>
    </html>
    but i do not know for this, how do i put my code. My code is below. Please somebody help me


    Code:
    <?php
    echo '<div align="center" style="width:100%; padding-top:20px;">
    <table width="100%" cellspacing="0" cellpadding="0" border="0">
          <tr>
            <td class=tddash>10 latest purchase orders</td>
          </tr>
          <tr>
            <td>';
    		$SQL = 'SELECT purchorders.orderno,
    						suppliers.suppname,
    						purchorders.orddate,
    						purchorders.deliverydate,
    						purchorders.initiator,
    						purchorders.requisitionno,
    						purchorders.allowprint,
    						purchorders.status,
    						suppliers.currcode,
    						currencies.decimalplaces AS currdecimalplaces,
    						SUM(purchorderdetails.unitprice*purchorderdetails.quantityord) AS ordervalue
    					FROM purchorders 
    					INNER JOIN purchorderdetails 
    					ON purchorders.orderno = purchorderdetails.orderno
    					INNER JOIN suppliers
    					ON purchorders.supplierno = suppliers.supplierid
    					INNER JOIN currencies 
    					ON suppliers.currcode=currencies.currabrev
    					WHERE purchorders.orderno=purchorderdetails.orderno
    					GROUP BY purchorders.orderno,
    						suppliers.suppname,
    						purchorders.orddate,
    						purchorders.initiator,
    						purchorders.requisitionno,
    						purchorders.allowprint,
    						purchorders.status,
    						suppliers.currcode,
    						currencies.decimalplaces LIMIT 5';
    						$SalesOrdersResult2 = DB_query($SQL,$db);
    						$Total = 0;
    				echo '<table width="100%" celpadding="2" class="selection">';
    						echo '<tbody><tr><th> Supplier </th><th>Order Date</th><th>Delivery Date</th><th>Initiator</th><th>Order Total</th><th>Status</th></tr></tbody> ';
    						$k=0;
    				while ($row = DB_fetch_array($SalesOrdersResult2))
    					//while ($row = mysql_fetch_array($SalesOrdersResult))
    					{
    						if ($k == 1){
    			echo '<tr class="EvenTableRows">';
    			$k = 0;
    		} else {
    			echo '<tr class="OddTableRows">';
    			$k = 1;
    		}
    						$FormatedOrderValue2 = locale_number_format($row['ordervalue'],$row['currdecimalplaces']);
    						$Total += $row['ordervalue'];
    						//$FormatedOrderValue1 = locale_number_format($myrow['ordervalue'],$_SESSION['CompanyRecord']['decimalplaces']);
    						$FormatedOrderDate1 = ConvertSQLDate($row['orddate']);
    						$FormatedDelDate1 = ConvertSQLDate($row['deliverydate']);
    						
    						echo ' <td> ' . $row['suppname'] . ' </td>';
    						echo ' <td>$FormatedOrderDate1</td><td>$FormatedDelDate1</td><td> ' . $row['initiator'] . ' </td><td>$FormatedOrderValue2</td><td> ' . $row['status'] . ' </td> ';
    					 
    					}
    		echo '<tr><td colspan="3">Total---</td><td colspan="2">$Total</td></tr></tbody>';			
    		echo '</table></td>';
    		
    		
         echo' </tr>
        </table>
    
    </div>';
    Last edited by Mythri; 07-18-2013 at 09:06 AM.

  • #2
    New Coder
    Join Date
    Jan 2011
    Posts
    92
    Thanks
    8
    Thanked 0 Times in 0 Posts
    can somebody help me plz?

  • #3
    New Coder
    Join Date
    Jan 2011
    Posts
    92
    Thanks
    8
    Thanked 0 Times in 0 Posts
    nobody knows about this?

  • #4
    Senior Coder
    Join Date
    Sep 2010
    Posts
    1,915
    Thanks
    15
    Thanked 227 Times in 227 Posts
    What's wrong with using Google charts ? It's what they are there for. Or is this just something that you want to learn about. If it is I can point you to several ways of doing it. I just wrote some code for plotting mathematical functions as line graphs using SVG, but there are other methods too.
    Welcome to http://www.myphotowizard.net

    where you can edit images, make a photo calendar, add text to images, and do much more.


    When you know what you're doing it's called Engineering, when you don't know, it's called Research and Development. And you can always charge more for Research and Development.


  •  

    Posting Permissions

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