Reputation: 2218
I am just playing with GWT charts but I am not quite understanding how it works.
I want to draw a simple column chart with Book Names on x-axis and Number of Books on y-axis. Here is the code.
DataTable table = DataTable.create();
ColumnChart columnChart;
table.addColumn(ColumnType.NUMBER, "Book 1");
table.addColumn(ColumnType.NUMBER, "Book 2");
table.addColumn(ColumnType.NUMBER, "Book 3");
table.addRows(3);
table.setValue(0, 0, 23);
table.setValue(1, 0, 65);
table.setValue(2, 0, 23);
columnChart.draw(table, options);
add(columnChart);
This isn't working and the screen comes blank. I've set the chart size and everything in the options
variable. Am I missing something?
Upvotes: 0
Views: 206
Reputation: 413
Make sure you have loaded the ChartLoader
API first.
ChartLoader chartLoader = new ChartLoader(ChartPackage.CORECHART);
chartLoader.loadApi(new Runnable() {
// draw your charts in here
}
Upvotes: 1