2
Contributors
8
Replies
23
Views
4 Years
Discussion Span
Last Post by winbala5
0
google.load("visualization", "1", {packages:["corechart"]});
      google.setOnLoadCallback(drawChart);
   function drawChart() {
       var data = new google.visualization.DataTable();
        data.addColumn('string', 'year');
         data.addColumn('number', 'accounts');
           data.addRows([
          ['year',  'accounts'],
        ]);
        var data = google.visualization.arrayToDataTable([
          ['Year', 'Sales'],
          ['2004',  1000],
          ['2005',  1170],
          ['2006',  660],
          ['2007',  1030],
          ['2008',  1000],
          ['2009',  1370],
          ['2010',  800],
          ['2011',  1730],
          ['2012',  400],
          ['2013',  670],
          ['2014',  360],
          ['2015',  30]

        ]);
    var data = new google.visualization.DataTable();

how to pass the array values from my database dynamatically. please help me

0

If you use PHP then you can generate the above code. PHP will connect to MySQL, get the data and build the array, which you can then output to your webpage in the right spot.

0
function drawChart() {
      // Prepare the data
         data.addColumn('string', 'year');
         data.addColumn('number', 'accounts');
        var data = google.visualization.arrayToDataTable([
        ['name', 'gender'],
          <?php   while($row = mysql_fetch_array($result)){ ?>
          ['<?php echo $row['name']?>' , '<?php echo $row['gender']?>',],
          <?php } ?>
        ]);

sir, i using like that php scripts but its not working.

0

sir, that mistake corrected but php file not include inside the js..

the error showing like that

function drawChart() {
      // Prepare the data
      <? 
      *Uncaught SyntaxError: Unexpected token < 


  what can i do for this..
0
 data.addColumn('string', 'year');
         data.addColumn('number', 'accounts');
        var data = google.visualization.arrayToDataTable([
        ['year', 'accounts'],
         <?php   while($row1 = mysql_fetch_array($query_check_login_details1)){ ?>
          ['<?php echo $row1['created_date']?>' , '<?php echo $row1['value']?>',]
          <?php } ?>
        ]);

error file: `

data.addColumn('string', 'year');
         data.addColumn('number', 'accounts');
        var data = google.visualization.arrayToDataTable([
        ['year', 'accounts'],
         <br />
Uncaught SyntaxError: Unexpected token <
<font size='1'><table class='xdebug-error xe-warning' dir='ltr' border='1' cellspacing='0' cellpadding='1'>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.