2010-08-30 43 views
0

我在帶有GChart的MacBook Pro上使用帶GAE的Eclipse。我的問題是,當我開發時無法顯示任何圖表,但是當我使用常規工具(如帶有GAE的按鈕或標籤)時,它們工作得很好。該代碼不給我任何錯誤,所以我假設我有權利代碼:
GAE上的GChart不會顯示


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("chartdiv").add(graf); 
     RootPanel.get("button").add(btnOk); 
    } 
} 

和我TestingTesting.gwt.xml文件看起來像這樣:

 

<?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> 
 

我TestingTesting.html看起來是這樣的:


<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> 

等,我在Eclipse項目的結構是

 
/
- 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 

任何人都可以幫我弄清楚問題可能是什麼?按鈕顯示沒有任何問題,但圖表不?

+0

可能是有益的,包括到庫的鏈接,您正在使用:http://code.google.com/p/clientsidegchart - 可能還對問這個圖書館的開發人員是否有用,他們可能會更好地瞭解發生了什麼問題。 – 2010-08-30 17:11:04

回答

0

我弄清楚我做錯了什麼。
我忘了在TestingTesting.java包括

RootPanel.get("chartdiv").add(graf); 
graf.update();  // you have to update your graph before it renders