List of usage examples for com.google.gwt.visualization.client DataTable setValueNull
public final native void setValueNull(int rowIndex, int columnIndex) ;
From source file:com.google.gwt.visualization.sample.visualizationshowcase.client.Showcase.java
License:Apache License
static DataTable getCompanyPerformanceWithNulls() { DataTable data = DataTable.create(); data.addColumn(ColumnType.STRING, "Year"); data.addColumn(ColumnType.NUMBER, "Sales"); data.addColumn(ColumnType.NUMBER, "Expenses"); data.addRows(4);/*from w w w . j a v a 2s . c o m*/ data.setValue(0, 0, "2004"); data.setValue(0, 1, 1000); data.setValue(0, 2, 400); data.setValue(1, 0, "2005"); data.setValue(1, 1, 1170); data.setValue(1, 2, 460); data.setValue(2, 0, "2006"); data.setValueNull(2, 1); data.setValueNull(2, 2); data.setValue(3, 0, "2007"); data.setValue(3, 1, 1030); data.setValue(3, 2, 540); return data; }
From source file:com.jythonui.client.charts.CharContainer.java
License:Apache License
private AbstractDataTable createTable(ListOfRows ro) { DataTable data = DataTable.create(); ChartFormat fo = iDialog.getD().findChart(id); for (FieldItem i : fo.getColList()) { String s = null;//from w w w . j a v a 2s . c o m if (!CUtil.EmptyS(i.getDisplayName())) s = iGetMessage.getMessage(i.getDisplayName()); ColumnType t = ColumnType.STRING; switch (i.getFieldType()) { case BIGDECIMAL: case INT: case LONG: t = ColumnType.NUMBER; break; case BOOLEAN: t = ColumnType.BOOLEAN; break; case DATE: t = ColumnType.DATE; break; case DATETIME: t = ColumnType.DATETIME; break; } if (s != null) data.addColumn(t, s); else data.addColumn(t); } data.addRows(ro.getRowList().size()); RowIndex ri = new RowIndex(fo.getColList()); int row = 0; for (RowContent r : ro.getRowList()) { int i = -1; for (FieldItem it : ri.getColList()) { i++; FieldValue val = r.getRow(i); if (val.getValue() == null) { data.setValueNull(row, i); continue; } switch (it.getFieldType()) { case BIGDECIMAL: BigDecimal b = val.getValueBD(); data.setValue(row, i, b.doubleValue()); break; case LONG: Long l = val.getValueL(); data.setValue(row, i, l.intValue()); break; case INT: Integer ival = val.getValueI(); data.setValue(row, i, ival.intValue()); break; case DATE: case DATETIME: Date d = val.getValueD(); data.setValue(row, i, d); break; case BOOLEAN: Boolean bval = val.getValueB(); data.setValue(row, i, bval.booleanValue()); break; default: data.setValue(row, i, val.getValueS()); break; } // switch } // for row++; } // for return data; }