<%// BasicSplineRiskMap:%>
<%
// Basic requirements for creating a SplineRiskMap:
// 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
// SplineRiskMap class, which requires calculated
// interpolation lines and colors to associate with
// axis values
// 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.Variable,
com.sas.graphics.components.PlotVariable,
com.sas.graphics.components.ClassificationVariable,
com.sas.graphics.components.SegmentedRangeModel,
com.sas.graphics.components.riskmapplot.RiskMapPlotTableDataModel,
com.sas.graphics.components.riskmapplot.SplineRiskMap,
javax.swing.table.DefaultTableModel,
java.awt.Color,
java.awt.geom.Point2D,
java.util.ArrayList,
java.util.List"
%>
<%
// 1) Create a RiskMapPlot and data source
RiskMapPlot riskMapPlot = new RiskMapPlot();
%>
<%@ include file="SplineRiskData.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("Weight in pounds"));
dataModel.setYVariable(new PlotVariable("Height in inches"));
dataModel.setGroupVariable(new ClassificationVariable("Patient"));
%>
<%@ include file="SplineRiskLines.jsp" %>
<%
// 4) Set up the desired risk map, in this case, a SplineRiskMap
ArrayList<List> lines = new ArrayList<List>();
lines.add(line1); // line1 is created in the include file SplineRiskLines.jsp
lines.add(line2); // line2 is created in the include file SplineRiskLines.jsp
lines.add(line3); // line3 is created in the include file SplineRiskLines.jsp
SplineRiskMap splineRiskMap = new SplineRiskMap(lines,
new Color[]{Color.YELLOW,Color.ORANGE,Color.RED,Color.WHITE});
// Set the data model and simple risk map on the riskMapPlot
riskMapPlot.setDataModel(dataModel);
riskMapPlot.getGraphModel().setRiskMap(splineRiskMap);
riskMapPlot.setWidth(450);
riskMapPlot.setHeight(600);
// 5) Set HTTP-specific response and request functionality
riskMapPlot.setResponse(response);
riskMapPlot.setRequest(request);
// Write the chart to the display
riskMapPlot.write(out);
%>