I am trying to display google chart using gwt native javascript but i am not getting any output below is my code:
GwtChart.html
<!doctype html> <!-- The DOCTYPE declaration above will set the --> <!-- browser's rendering engine into --> <!-- "Standards Mode". Replacing this declaration --> <!-- with a "Quirks Mode" doctype is not supported. --> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <!-- --> <!-- Consider inlining CSS to reduce the number of requested files --> <!-- --> <link type="text/css" rel="stylesheet" href="GwtChart.css"> <!-- --> <!-- Any title is fine --> <!-- --> <title>Web Application Starter Project</title> <!-- --> <!-- This script loads your compiled module. --> <!-- If you add any GWT meta tags, they must --> <!-- be added before this line. --> <!-- --> <script type="text/javascript" language="javascript" src="gwtchart/gwtchart.nocache.js"></script> <script type="text/javascript" src="http://www.google.com/jsapi"></script> </head> <body> <div id="visualization" style="width: 600px; height: 400px;"></div> </body> </html>
GwtChart.java
public class GwtChart implements EntryPoint { //ChartServiceAsync chartService=GWT.create(ChartService.class); public void onModuleLoad() { createChart() ; } private native void createChart() /*-{ $wnd.google.load('visualization', '1', {packages: ['corechart']}); function drawVisualization() { // Create and populate the data table. var data = $wnd.google.visualization.arrayToDataTable([ ['Year', 'Austria', 'Bulgaria', 'Denmark', 'Greece'], ['2003', 1336060, 400361, 1001582, 997974], ['2004', 1538156, 366849, 1119450, 941795], ['2005', 1576579, 440514, 993360, 930593], ['2006', 1600652, 434552, 1004163, 897127], ['2007', 1968113, 393032, 979198, 1080887], ['2008', 1901067, 517206, 916965, 1056036] ]); new $wnd.google.visualization.BarChart($wnd.document.getElementById('visualization')). draw(data, {title:"Yearly Coffee Consumption by Country", width:600, height:400, vAxis: {title: "Year"}, hAxis: {title: "Cups"}} ); } $wnd.google.setOnLoadCallback(drawVisualization); }-*/; }
can any body help me coding google chart using native javascript in gwt.
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 google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment