0

GChartを搭載したMacBookProでGAEを搭載したEclipseを使用しています。私の問題は、開発中にチャートを表示できないことですが、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>

私の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システムライブラリ
 --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
 - 戦争
 --TestTest.html
 -WEB-INF
 --appengine-web.xml
 --logging.properties
 --web.xml
 

誰かが私が問題が何であるかを理解するのを手伝ってくれる?ボタンは問題なく表示されますが、チャートは表示されませんか?

4

1 に答える 1

0

私は自分が間違っていたことを理解しました。
TestingTesting.java に含めるのを忘れていました

RootPanel.get("chartdiv").add(graf); 
graf.update();      // you have to update your graph before it renders
于 2010-09-02T10:20:15.680 に答える