I'm trying to configure a basic cube grid. i get data from data base in this form:
origin, destination,dates, bookings,fare,revenue:
LHR, SIN,200901,100,200,20000
LHR, NYC,200901,300,100,30000
so I'm using the following code to set facets:
Cube grid is not drawn.
but if i change the lines which set the facets to this:
Cube grid is drawn with column headers as dates field and data filled with bookings.
i'm trying to replicate the sample in showcase and want to show bookings, revenue, fare as column facets and values instead of only bookings.
origin, destination,dates, bookings,fare,revenue:
LHR, SIN,200901,100,200,20000
LHR, NYC,200901,300,100,30000
so I'm using the following code to set facets:
Code:
public void createCubeGrid(final VLayout rLayout) { DataSource dS = DataSource.get("adb"); DSRequest dSR = new DSRequest(); dSR.setOperationId("cubeGrid"); final CubeGrid inCube = new CubeGrid(); dS.fetchData(new Criteria(), new DSCallback() { public void execute(DSResponse dsResponse, Object o, DSRequest dsRequest) { if (SC.hasAnalytics()) { //in order to enable charting, the Drawing module must be present if (SC.hasDrawing()) { inCube.setEnableCharting(true); } inCube.setData(dsResponse.getData()); inCube.setWidth100(); inCube.setHeight100(); inCube.setHideEmptyFacetValues(true); inCube.setShowCellContextMenus(true); final NumberFormat numberFormat = NumberFormat.getFormat("0,000"); inCube.setCellFormatter(new CellFormatter() { public String format(Object value, ListGridRecord record, int rowNum, int colNum) { if (value == null) return null; try { return numberFormat.format(((Number) value).longValue()); } catch (Exception e) { return value.toString(); } } }); // inCube.setValueProperty("bookings"); inCube.setRowFacets("ORIG", "DEST"); inCube.setColumnFacets("dates","bookings"); rLayout.addMember(inCube); } else { HTMLFlow htmlFlow = new HTMLFlow("<div class='explorerCheckErrorMessage'><p>This example is disabled in this SDK because it requires the optional " + "<a href=\"http://www.smartclient.com/product/index.jsp\" target=\"_blank\">Analytics module</a>.</p>" + "<p>Click <a href=\"http://www.smartclient.com/smartgwtee/showcase/#cube-analytics\" target=\"\">here</a> to see this example on smartclient.com</p></div>"); htmlFlow.setWidth100(); } } }, dSR); }
but if i change the lines which set the facets to this:
Code:
inCube.setValueProperty("bookings"); inCube.setRowFacets("ORIG", "DEST"); inCube.setColumnFacets("dates");
i'm trying to replicate the sample in showcase and want to show bookings, revenue, fare as column facets and values instead of only bookings.
Comment