<%// BasicRequirements:%>


<%
// Basic requirements for creating a radar chart:
//   1) Create a RadarChart instance and a data source 
//   2) Create a data model and attach the data source to it
//   3) Assign the Category and Response variable roles
//      to appropriate variables
//   4) Assign the data model to the RadarChart
// To set a title or footnote, get the appropriate RadarChart
// title or footnote, and then set the returned object's text.
%>

<%@page import="com.sas.swing.models.TableModelAdapter,
                 com.sas.models.SimpleTable,
                 com.sas.servlet.tbeans.graphics.html.RadarChart,
                 com.sas.graphics.components.radarchart.RadarChartTableDataModel,
                 com.sas.graphics.components.AnalysisVariable,
                 com.sas.graphics.components.ClassificationVariable"
%>

<%
  // 1) Create a RadarChart instance
        RadarChart radarChart = new RadarChart();

  // Create a simple SAS table and add data to it
     SimpleTable table = new SimpleTable();
%>

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

<% 
     // Convert a simple SAS table to a simple Java Swing table
        TableModelAdapter tma = new TableModelAdapter(table);
        tma.setFormattedDataUsed(false);

     // 2) Create a data model and attach the data source to it
           RadarChartTableDataModel radarChartDataModel=
              new RadarChartTableDataModel(tma);

     // 3) Assign the Category and Response variable roles
           radarChartDataModel.setCategoryVariable(
              new ClassificationVariable("Cause"));
           radarChartDataModel.setResponseVariable(
              new AnalysisVariable("Count"));

     // 4) Assign the data model to the RadarChart
           radarChart.setDataModel(radarChartDataModel);

     // Set a title
        radarChart.getTitle1().setText("Causes of Failure");
     
     // 5) Set HTTP-specific response and request functionality
           radarChart.setResponse(response);
           radarChart.setRequest(request);

     // Write the chart to the display
        radarChart.write(out);
%>