GAE上的GChart不会显示

时间:2010-08-30 16:35:24

标签: eclipse google-app-engine gwt gchart

我在带有GChart的MacBook Pro上使用Eclipse和GAE。我的问题是我在开发时无法显示任何图表,但是当我使用常规工具(如按钮或标签)和GAE时,它们工作得很好。代码没有给我任何错误,所以我假设我有正确的代码:


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>

My 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
 

任何人都可以帮我弄清问题是什么吗?按钮显示没有任何问题,但图表没有?

1 个答案:

答案 0 :(得分:0)

我弄清楚我做错了什么 我在TestingTesting.java上忘了包含

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