<%// ReverseAxis:%>
<%
// To reverse the axis, do the following:
// 1) Set the axis ranges in reverse order for the reverse axis values
// 2) Set the appropriate color values for the risk map
// 3) Use the RiskMapPlotModel to get the axis model, and then call the
// returned model's setReverseDirection() method with the value true
%>
<%@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"
%>
<%
// 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[]{200, 160, 135, 120, 0});
SegmentedRangeModel yRange = SegmentedRangeModel.
newSegmentedRangeModel(new double[]{400, 160, 120, 100, 0});
SimpleRiskMap simpleRiskMap = new SimpleRiskMap(xRange, yRange,
new Color[]{Color.RED,Color.ORANGE, Color.YELLOW, Color.GREEN},
SimpleRiskMap.TYPE_BLOCK);
// Set the data model and simple risk map on the riskMapPlot
riskMapPlot.setDataModel(dataModel);
riskMapPlot.getGraphModel().setRiskMap(simpleRiskMap);
riskMapPlot.getGraphModel().getXAxisModel().setReverseDirection(true);
riskMapPlot.getGraphModel().getYAxisModel().setReverseDirection(true);
// Set HTTP-specific response and request functionality
riskMapPlot.setResponse(response);
riskMapPlot.setRequest(request);
// Write the chart to the display
riskMapPlot.write(out);
%>