I am using Eclipse with GAE on a MacBook Pro with GChart. My problem is that I cant get any chart to show when I am developing, but when I use regular tools such as Buttons or Labels with GAE they work just fine. The code doesn't give me any errors, so I am assuming that I have the right code:
public class TestingTesting implements EntryPoint {
public void onModuleLoad() {
GChart graf = new GChart();
graf.setTitle("testing");
graf.setChartSize(200, 200);
graf.addCurve();
graf.getCurve().getSymbol().setFillThickness(2);
for (int i = 0; i < 10; i++)
graf.getCurve().addPoint(i,i*i);
Button btnOk = new Button("Ok");
RootPanel.get("chart开发者_如何学JAVAdiv").add(graf);
RootPanel.get("button").add(btnOk);
}
}
and my TestingTesting.gwt.xml file looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='testingtesting'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />
<!-- Inherit the default GWT style sheet. You can change -->
<!-- the theme of your GWT application by uncommenting -->
<!-- any one of the following lines. -->
<inherits name='com.google.gwt.user.theme.standard.Standard' />
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
<!-- Other module inherits -->
<inherits name='com.googlecode.gchart.GChart' />
<!-- Specify the app entry point class. -->
<entry-point class='test.gchart.sollution.client.TestingTesting' />
<!-- Specify the paths for translatable code -->
<source path='client' />
<source path='shared' />
</module>
My TestingTesting.html looks like this:
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Chart Example</title>
<script type="text/javascript" language="javascript"
src="testingtesting/testingtesting.nocache.js"></script>
</head>
<body>
<div id="chartdiv"></div>
<div id="button"></div>
</body>
</html>
other than that, my structure of the project in Eclipse is
/ - gchart.jar - App Engine SDK [App Engine 1.3.5] - GWT SDK [GWT - 2.0.4] - JRE System Library - src -- test.gchart.sollution --- TestingTesting.gwt.xml -- test.gchart.sollution.client --- TestingTesting.java -- test.gchart.sollution.server -- test.gchart.sollution.shared --- FieldVerifier.java - META-INF -- jdoconfig.xml - log4j.properties - war -- TestTest.html - WEB-INF -- appengine-web.xml -- logging.properties -- web.xml
Can anyone help me to figure out what the problem might be? The button shows without any problem, but the chart doesn't?
I figuered out what I've made wrong.
I forgot on the TestingTesting.java to include
RootPanel.get("chartdiv").add(graf);
graf.update(); // you have to update your graph before it renders
精彩评论