2010-08-30 40 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