Hi All
Im getting the "table has no columns" all the time. Please let me know
where I went wrong.
Below are my codes.
JSP: pie.jsp (This is to pull data from DB/DS. Currently Im trying with
hardcode values as below.)
<%@page contentType="application/json; charset=UTF-8"%>
<%@page import="net.sf.json.JSONObject,net.sf.json.JSONArray"%>
<%
JSONObject obj=new JSONObject();
obj.put("name","foo");
obj.put("num",new Integer(100));
obj.put("balance",new Double(1000.21));
obj.put("is_vip",new Boolean(true));
obj.put("nickname",null);
out.print(obj);
out.flush();
%>
JSP: Charts.jsp (This is to show the output chart)
<html>
<head>
<title>Charts</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"
/>
<script type="text/javascript" src="js/jsapi.js"></script>
<script type="text/javascript"
src="js/jquery-1.7.1.min.js"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var jsonData = $.ajax({
url: "./charts/pie.jsp",
dataType:"json",
async: false,
options: {'title': 'Reports'}
}).responseText;
var data = new google.visualization.DataTable(jsonData);
// var data = new
google.visualization.arrayToDataTable(jsonData);
var chart = new
google.visualization.PieChart(document.getElementById('chart_div'));
chart.draw(data, {width: 400, height: 240});
}
</script>
</head>
<body>
<h3>Charts Demo</h3>
<div id="chart_div" style="width: 400px; height: 200px;"></div>
</body>
</html>
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.