Dear all,
I'm a new guy to Javascript and writing something for fun with
Google Chart recently. One problem has bothered me for a long time.
Here is part of the code.
<head>
...
<script type="text/javascript" src="http://code.jquery.com/jquery-
latest.js"></script>
<script type="text/javascript" src="https://www.google.com/jsapi"></
script>
<script type="text/javascript">
google.load('visualization', '1.0', {'packages':['corechart']});
google.setOnLoadCallback(drawTopTenMonthlyException);
function drawTopTenMonthlyException(){
var jsonString = eval($('#form\
\:topTenExceptionJsonString').val());
var monthlyData = new google.visualization.DataTable();
monthlyData.addColumn('string', 'moduleName');
monthlyData.addColumn('number', 'exceptionNumber');
monthlyData.addColumn('string', 'exceptionType');
if(fillDatatableByJsonString(monthlyData,
jsonString).getNumberOfRows() > 0){
var options = {width: 400, height: 240,title: 'Top Ten
Exception'};
var chart = new
google.visualization.BarChart(document.getElementById('topTenException'));
chart.draw(monthlyData, options);
}
}
function fillDatatableByJsonString(dataTable, jsonString){
for(var i = 0; i < jsonString.length; i++){
dataTable.addRow([jsonString[i].moduleName,jsonString[i].amount,jsonString[i].exceptionType]);
}
return dataTable;
}
</script>
</head>
...
The previous page works well in the same way to draw. However, when
it comes to this page, exception called "google.visualization is
undefined" happened. I googled and found no perfect solution. BTW, The
hidden data is successfully accessed by eval() function. Could you pls
help me?
--
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.