<%// ChangeLine:%>



<%
// To change the line style for needle lines:
//   1) Define a MarkerStyle for the plot markers
//   2) Get the RiskMapPlotModel and call its setInterpolationEnabled()
//      method to enable interpolation
//   3) Call the MarkerStyle's setInterpolation() method to set
//      the interpolation type
//   4) Define a LineStyle and call the RiskMapPlotModel's
//      setNeedleLineStyle() method to set the interpolation type

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

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

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

  // 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);
     RiskMapPlotModel graphModel=riskMapPlot.getGraphModel();
     graphModel.setRiskMap(simpleRiskMap);

//   1) Define a MarkerStyle for the plot markers
        MarkerStyle[] markerStyle=new MarkerStyle[] {
              new MarkerStyle(MarkerStyle.SYMBOL_SQUARE_FILLED)};
        graphModel.getDataElementStyles().setMarkerStyles(markerStyle);

//   2) Call setInterpolationEnabled() to enable interpolation
        graphModel.setInterpolationEnabled(true);

//   3) Call the MarkerStyle's setInterpolation() method to set the interpolation type
        markerStyle[0].setInterpolation(MarkerStyle.INTERPOLATION_VERTICAL_NEEDLES);

//   4) Define a LineStyle and call setNeedleLineStyle() to set the interpolation type
        LineStyle lineStyle = new LineStyle(
          Color.gray,
          new BaseLength(3, "pt"),
          GraphConstants.TRUE);
        graphModel.setNeedleLineStyle(lineStyle);

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

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