You are creating rowData as a string, not an array, which is why it doesn't
work. Try this instead:
var rowData = ['a', 10];
for (var i=0;i<=10;i++){
c[i]= id.firstChild.getElementsByTagName('th')[i].innerHTML;
rowData.push([c[i], 10]);
}
On Monday, December 10, 2012 3:21:21 AM UTC-5, Logesh waran wrote:
>
> Hi ,
> I am using a javascript function to get the row data and storing that in a
> variable called 'rowData' .
> Now the value of rowData is ['CVS update Issue',10],['Testbed Issue -
> Ping Failure',10],['Testbed Issue - Software Missing',10]
> But when substituted in the addRows([rowData]) it is not creating any
> chart .
> But when the values is directly given without using a variable , the chart
> is produced .
>
> Please see my script below .Kindly help .
>
> <script type="text/javascript">
>
> google.load('visualization', '1.0', {'packages':['corechart']});
> google.setOnLoadCallback(drawChart);
>
> function drawChart() {
> var data = new google.visualization.DataTable();
>
> var rowData="['a',10]";
>
> var id= document.getElementById('summary');
>
> var c = new Array();
>
> for(var i=0;i<=10;i++){
> c[i]= id.firstChild.getElementsByTagName('th')[i].innerHTML;
> rowData="['"+c[i]+"',10]"+','+ rowData;
> }
>
>
> data.addColumn('string', 'Suite');
> data.addColumn('number', 'TestCases');
> data.addRows(rowData);
> // Here is where the problem is .how can i
> handle this with a variable .
> var options = {'title':'FA','width':400,'height':300};
> var chart = new
> google.visualization.PieChart(document.getElementById('chart_div'));
> chart.draw(data, options);
> }
> </script>
>
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-visualization-api/-/qZFolT1BwtgJ.
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.