1

私はGChartからこの簡単な例を使用しています

      public void displayGChart(final ArrayList<ResultDTO> result){

        GChart c = new GChart();
        c.setChartTitle("<b>x<sup>2</sup> vs x</b>");
        c. setChartSize(150, 150);
        c. addCurve();
         for (int i = 0; i < 10; i++) 
             c.  getCurve().addPoint(i,i*i);
         c.getCurve().setLegendLabel("x<sup>2</sup>");
         c. getXAxis().setAxisLabel("x");
         c. getYAxis().setAxisLabel("x<sup>2</sup>");


    verticalPanel.add(c);
    verticalPanel.add(new Label("test"));
}

アプリケーションを実行すると、エラーは発生しませんでした。ブラウザでこの「テスト」を見ることができますが、他には何も表示されず、グラフは表示されません..

私は瓶を追加しました

            <inherits name='com.googlecode.gchart.GChart' />

理由は何か

4

1 に答える 1

2

c.update(); を呼び出してください。チャートをパネルに追加した後、次のようにします。

    verticalPanel.add(c);
    c.update();
    verticalPanel.add(new Label("test"));

これはここでも説明されています: http://clientsidegchart.googlecode.com/svn/trunk/javadoc/com/googlecode/gchart/client/package-summary.html :

チャートはありませんか?これらの例では、チャートのみを定義しています。実際に表示するには、追加して更新する必要があります。

    // Use this typical GChart boilerplate to test out these examples:
    GChart gchart = new GChartExample00(); 
    RootPanel.get().add(gchart);
    gchart.update();
于 2012-09-22T15:14:11.730 に答える