<%// BasicRequirements:%>

    <%
    // Basic requirements for creating a RiskMapPlot:
    //   1) Create a RiskMapPlot instance and a data source
    //   2) Create a data model and attach the data source to it
    //   3) Set up the desired risk map. This example uses the
    //      SimpleRiskMap class, which requires SegmentedRangeModel
    //      values for the X and Y axes, colors to associate with the
    //      axis values, and the type of simple risk map you want
    //   4) Construct a RiskMapPlot that uses the data model and risk map
    //   5) Set HTTP-specific response and request functionality

    %>
    <%@page import="com.sas.servlet.tbeans.graphics.html.RiskMapPlot,
          com.sas.graphics.components.PlotVariable,
          com.sas.graphics.components.SegmentedRangeModel,
          com.sas.graphics.components.riskmapplot.RiskMapPlotTableDataModel,
          com.sas.graphics.components.riskmapplot.SimpleRiskMap,
          javax.swing.table.DefaultTableModel,
          java.awt.Color"
    %>
    <%
      // 1) Create a RiskMapPlot and data source
         RiskMapPlot riskMapPlot = new RiskMapPlot();
    %>
             <%@ include file="SimpleRiskData.jsp" %>

    <%
      // 2) Create a data model and attach the data source to it
         RiskMapPlotTableDataModel dataModel=
           new RiskMapPlotTableDataModel(dataTable);

      // 3) Assign the X and Y variable roles
         dataModel.setXVariable(new PlotVariable("Systolic Blood Pressure"));
         dataModel.setYVariable(new PlotVariable("Blood Sugar"));

      // 4) Set up the desired risk map, in this case, a SimpleRiskMap
         SegmentedRangeModel xRange = SegmentedRangeModel.
           newSegmentedRangeModel(new double[]{0, 120, 135, 160, 200});
         SegmentedRangeModel yRange = SegmentedRangeModel.
           newSegmentedRangeModel(new double[]{0, 100, 120, 160, 400});

         SimpleRiskMap simpleRiskMap = new SimpleRiskMap(xRange, yRange,
           new Color[]{Color.GREEN,Color.YELLOW, Color.ORANGE, Color.RED},
           SimpleRiskMap.TYPE_BLOCK);

      // Set the data model and simple risk map on the riskMapPlot
         riskMapPlot.setDataModel(dataModel);
         riskMapPlot.getGraphModel().setRiskMap(simpleRiskMap);

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

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