TileChartOLAPDataModel: Basic Requirements

The main responsibility of a TileChartOLAPDataModel is to map data measures from an OLAP data structure to variable roles in a tile chart.

In your code, you can explicitly select measures in the OLAP data, or allow the component's OLAP data model to select measures by default.

A TileChart's primary variable roles are

TileVariable
Specifies a classification variable whose values determine the number and arrangement of tiles in the chart. A TileChartOLAPDataModel maps this role to the first measure in the OLAP structure.
SizeVariable
Specifies an analysis variable whose values determine the tile sizes. A TileChartOLAPDataModel maps this role to the second measure in the OLAP structure.

To access OLAP data for a graph, you must know the name of the OLAP host server and connect to that server with a valid username and password. To use the OLAP data in a TileChart, you must

The following code fragment generates a tile chart that plots actual sums against predicted sums for selected products, years, and countries.


// Create strings to store an SQL query, the OLAP server name,
// and the connection port.
   String OLAP_QUERY="SELECT "
                   + "{[PRODUCTLINE].[PRODUCT].MEMBERS} ON COLUMNS,"
                   + "CROSSJOIN({[TIME].[YEAR].MEMBERS},"
                   + "{[Measures].[ACTUAL_SUM],[Measures].[PREDICT_SUM]}) ON ROWS "
                   + "FROM MYOLAPCUBE";   // specify a valid OLAP data source
   String OLAP_SERVER="myOlapServer.com"; // use a valid server name
   int OLAP_PORT=8800;                    // use a valid port

// Create a TileChartOLAPDataModel from an OLAPDataSet.
   TileChartOLAPDataModel olapDataModel = null;
   try {
        // OLAPDataSet arguments: host, port, username, pwd, query
           olapDataModel=new TileChartOLAPDataModel(
           new OLAPDataSet(OLAP_SERVER, OLAP_PORT, "myUsername", "myPwd",
                           OLAP_QUERY));
       } catch (Exception ex) { ex.printStackTrace(); }

// Create a TileChart that uses the TileChartOLAPDataModel as its data model
   TileChart tileChart=new TileChart();
   tileChart.setDataModel(olapDataModel);