<%// BasicRequirements:%>


<%
// Basic requirements for creating a tile chart:
//   1) Create a TileChart instance and a data source 
//   2) Create a data model and attach the data source to it
//   3) Assign the Tile variable role and the Size variable
//      role to appropriate variables
//   4) Assign the data model to the TileChart
//   5) Set HTTP-specific response and request functionality
// To set a title or footnote, get the appropriate TileChart
// title or footnote, and then set the returned object's text.
%>
<%@page import="com.sas.servlet.tbeans.graphics.html.TileChart,
        com.sas.graphics.components.tilechart.TileChartTableDataModel,
        com.sas.graphics.components.AnalysisVariable,
        com.sas.graphics.components.ClassificationVariable,
        javax.swing.table.DefaultTableModel"
%>
<%
  // 1) Create a TileChart and a data source 
     TileChart tileChart=new TileChart();
%>

   <%@ include file="SalesData.jsp" %>

<%
  // 2) Create a data model and attach the data source
     TileChartTableDataModel dataModel=
               new TileChartTableDataModel();
     dataModel.setModel(dataTable);

  // 3) Assign the Tile and Size variable roles to
  // appropriate variables
     dataModel.setTileVariable(
               new ClassificationVariable("Region"));
     dataModel.setSizeVariable(
               new AnalysisVariable("Inventory"));

  // 4) Assign the data model to the TileChart
     tileChart.setDataModel(dataModel);

  // Set a graph title
     tileChart.getTitle1().setText("tile size represents Inventory");

  // 5) Set HTTP-specific response and request functionality
     tileChart.setResponse(response);
     tileChart.setRequest(request);

  // Set a graph size and write the chart to the display
     tileChart.setWidth(600);
     tileChart.setHeight(450);
     tileChart.write(out);
%>