Google charts multiline dynamic charts -


am new php coding & have few google charts working. of these charts i've generated far based on (date,number of event occurrences) type of chart. i'm trying plot google chart data output of sql query.

the output of sql query looks below

|series|date_1|date_2|date_3| |a|2|3|
|b|4|6|
|c|7|8|

both series & date_1 can vary. say, based on various conditions in sql query, number of date_ can vary & can series.

i have pass output google chart plot code.

here i've tried coding far

    $link = mysql_connect("localhost", "user", "pass");     $dbcheck = mysql_select_db("database");      if ($dbcheck) {         $chart_array_1[] = "['my_date','my_name','#num_occurences']";         $result = mysql_query($sql);         if (mysql_num_rows($result) > 0) {             while ($row = mysql_fetch_assoc($result)) {                 $my_date=$row["my_date"];                 $my_ins=$row["my_name"];                 $my_count=$row["my_count"];                 $chart_array_1[]="['".$my_date."','".$my_ins."',".$my_count."]";             }         }     }     mysqli_close($link);   <script type="text/javascript">             // load visualization api , piechart package.             google.load('visualization', '1', {'packages':['corechart']});              // set callback run when google visualization api loaded.             google.setonloadcallback(drawchart);              function drawchart() {                 // create our data table out of json data loaded server.                 var data_1  = google.visualization.arraytodatatable([<?php echo (implode(",", $chart_array_1)); ?>])                  var options = {                     bar: {groupwidth: "6%"},                      trendlines: {                         1: {                           type: 'linear',                           color: 'green',                           linewidth: 3,                           opacity: 0.3,                           showr2: true,                           visibleinlegend: true                         }                       },                     chartarea: {                         left: 70,                         top: 61,                         width:'95%',                         height:'70%'                     },                     curvetype: 'function',                     //width: 1600,                     height: 400,                     pointsize: 4,                     linewidth: 2,                     visibleinlegend: false,                     vaxis: {                          //title: "gc#",                         logscale: true,                         titletextstyle: {                             color: 'black'                         }                     },                     haxis: {                         title: "timeline",                         titletextstyle: {                             bold: false,                             color: 'black'                         }                     },                     legend: {                         position: 'top',                         alignment: 'center',                         textstyle: {                             color: 'blue'                         }                     }                 };                 var chart_1 = new google.visualization.linechart(document.getelementbyid('plot1'));               chart_1.draw(data_1, options);             } </script> 

i'm unable plot graph. error "data column(s) axis #0 cannot of type string×". please me here.

i'd see a,b,c etc separate series each while date goes on x-axis. please note after generating data dynamically using sql query & not static array examples demonstrate. please help?

managed implement thing different way. hence question can ignored.


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -