【问题标题】:gchart not appearinggchart没有出现
【发布时间】:2012-09-22 07:07:06
【问题描述】:

我正在使用 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' />

任何想法可能是什么原因

【问题讨论】:

    标签: gwt gchart


    【解决方案1】:

    请调用 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();
    

    【讨论】:

      猜你喜欢
      • 2011-03-07
      • 1970-01-01
      • 2021-02-11
      • 2015-01-19
      • 2012-09-21
      • 2021-02-15
      • 2014-05-31
      • 2013-12-02
      • 2021-03-05
      相关资源
      最近更新 更多