我正在用谷歌可视化制作我的第一个图表,试图制作一个简单的条形图
我从这个例子中得到了这个:
VerticalPanel vp = new VerticalPanel();
Options options = Options.create();
options.setHeight(240);
options.setTitle("Company Performance");
options.setWidth(400);
options.set3D(true);
DataTable data = DataTable.create();
data.addColumn(ColumnType.STRING, "Year");
data.addColumn(ColumnType.NUMBER, "Sales");
data.addColumn(ColumnType.NUMBER, "Expenses");
data.addRows(4);
data.setValue(0, 0, "2004");
VisualizationWidget<BarChart, BarChart.Options> widget =
BarChart.createWidget(data, options);
BarChart viz = widget.getVisualization();
Label status = new Label();
viz.addSelectHandler(new SelectionDemo(viz, status));
vp.add(status);
vp.add(widget);
这条线
VisualizationWidget<BarChart, BarChart.Options> widget =
BarChart.createWidget(data, options);
说
VisualizationWidget cannot be resolved to a type
编译错误:
[ERROR] Line 150: VisualizationWidget cannot be resolved to a type
[ERROR] Line 151: The method createWidget(DataTable, PieChart.Options) is undefined for the type BarChart
[ERROR] Line 154: SelectionDemo cannot be resolved to a type
我无法理解这个 VisualizationWidget 是什么,如果你能指导我如何解决这个问题
谢谢