It would be best to separate the two parts - one is parsing the data (from SQL, using PHP, what ever you choose) and the other is drawing the chart. It would make it easier to isolate the chart-related problem if such exists.
Viz Kid On Sat, Apr 28, 2012 at 2:09 PM, Monty <[email protected]> wrote: > I am trying to develop annotedtimeline graph from MYSQL data. I have > retrieve the value from mysql and have passed it to Google graph.I am > ale to see the blank graph.Dont know where is my mistake.Below is the > source code of > > <body> > <script type="text/javascript"> > var encoded_P1data = > ["1111","1234","1111","1111","1234","1111","1111","1234","1111","1111"]; > var encoded_P2data = > ["2222","2345","2222","2222","2345","2222","2222","2345","2222","2222"]; > var encoded_P3data = > ["3333","3456","3333","3333","3456","3333","3333","3456","3333","3333"]; > var encoded_P4data = > ["4444","4567","4444","4444","4567","4444","4444","4567","4444","4444"]; > var encoded_xdata = > > ["10:20:00","10:20:00","10:20:00","10:20:00","10:20:00","10:20:00","10:20:00","10:20:00","10:20:00","10:20:00"]; > </script> > <script type="text/javascript" src="jsapi.js"></script> > <script type="text/javascript"> > google.load('visualization', '1', {'packages':['annotatedtimeline']}); > google.setOnLoadCallback(drawChart); > var chart; > var RecordTime= new Array; > > var P1data = new Array; // This would be the first array passed from > PHP > > var P2data = new Array; // This would be the second array passed from > PHP > > var P3data= new Array; // This would be the third array passed from > PHP > > var P4data = new Array; // This would be the second array passed from > PHP > > > P1data = encoded_P1data; > > P2data = encoded_P2data; > > P3data= encoded_P3data; > > P4data = encoded_P4data; > > RecordTime = encoded_xdata ; > > > > function drawChart() { > > var data = new google.visualization.DataTable(); > > data.addColumn('datetime', 'RecordTime'); > > data.addColumn('number', 'P1'); > > data.addColumn('number', 'P2'); > > data.addColumn('number', 'P3'); > > data.addColumn('number', 'P4'); > > /* create for loops to add as many columns as necessary */ > var len = encoded_P1data.length; > data.addRows(len); > > for(i=0; i<len; i++) > { > data.setValue(i, 0, new Date(RecordTime[i])), > > data.setValue(i, 1, parseInt(P1data[i])), /* Y-axis category #1*/ > > data.setValue(i, 2, parseInt(P2data[i])), /* Y-axis category #2*/ > > data.setValue(i, 3, parseInt(P3data[i])), /* Y-axis category #3*/ > > data.setValue(i, 4, parseInt(P4data[i])) /* Y-axis category #4*/ > > } > > /*********************************end of > loops***************************************/ > > chart = new > > google.visualization.AnnotatedTimeLine(document.getElementById('chart_div')); > > chart.allowRedraw = true; > > chart.draw(data, {displayAnnotations: false }); > > } > > //chart.draw(data); > > > > </script> > > <div id='chart_div' style='width: 800px; height: 600px;'></div> > > </body> > > -- > You received this message because you are subscribed to the Google Groups > "Google Visualization API" group. > To post to this group, send email to > [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-visualization-api?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Google Visualization API" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.
