我使用了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"));
}当我运行应用程序时,我没有得到任何错误,我可以在我的浏览器上看到这个“测试”,但没有其他东西,没有出现图表。
我已经添加了jar和
<inherits name='com.googlecode.gchart.GChart' />你知道原因是什么吗?
发布于 2012-09-22 23:14:12
请在将图表添加到面板后调用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();https://stackoverflow.com/questions/12541591
复制相似问题