Google Visualization Java API gives error if adding row to datatable

66 views
Skip to first unread message

ah89

unread,
Dec 21, 2012, 8:34:12 AM12/21/12
to google-visua...@googlegroups.com
Hey,

This is what I am trying to accomplish:

public DataTable generateDataTable() {
        DataTable data = new DataTable();
        data.addColumn(new ColumnDescription("Metric", ValueType.TEXT, "Metric"));
        data.addColumn(new ColumnDescription("Statistic", ValueType.NUMBER, "Statistic"));

        TableRow row = new TableRow();
        row.addCell("Pizza");
        row.addCell(20.0);

        try {
            data.addRow(row);
        } catch (TypeMismatchException e) {
            e.printStackTrace();
        }

        return data;
      }
}

The line with 'data.addRow(row)' gives an internal server error, but I have no idea why.
My goal is to use the DataTable without the use of an extra google-servlet (the examples use:
SimpleExampleServlet extends DataSourceServlet).

How can I create a datatable, that will be saved in a request?

Thanks in advance

Sergey Grabkovsky

unread,
Dec 21, 2012, 10:49:19 AM12/21/12
to google-visua...@googlegroups.com
Hi, it would be helpful if you could give the error that the data.addRow throws, as without it it's a bit harder to track down exactly what is wrong with the code.

- Sergey




--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-visualization-api/-/TBKpeEGclpIJ.
To post to this group, send email to google-visua...@googlegroups.com.
To unsubscribe from this group, send email to google-visualizati...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.

Reply all
Reply to author
Forward
0 new messages