<%// ChangeAxis:%>
<%
// A graph's display properties (including axis characteristics)
// are general properties that are defined in the graph's model.
// Thus, to change a WaterfallChart's axis characteristics,
// 1) Create an AxisModel and any other objects needed to define
// axis characteristics (line style, tick intervals, ...)
// 2) Use the WaterfallChart to set the axis definitions on the chart
// This example creates a StrokeLineStyle to define a
// 3pt solid red line for both the Category and Response axes.
// It creates an AxisModel to suppress the axis label and define
// a line style and tick characteristics for the Response axis.
%>
<%@page import="com.sas.servlet.tbeans.graphics.html.WaterfallChart,
com.sas.graphics.components.waterfallchart.WaterfallChartTableDataModel,
com.sas.graphics.components.AnalysisVariable,
com.sas.graphics.components.ClassificationVariable,
com.sas.graphics.components.AxisModel,
com.sas.graphics.components.GraphConstants,
com.sas.graphics.components.StrokeLineStyle,
com.sas.measures.BaseLength,
java.awt.Color,
javax.swing.table.DefaultTableModel"
%>
<%
// Create a WaterfallChart and a data source
WaterfallChart waterfallChart=new WaterfallChart();
%>
<%@ include file="TransactionData.jsp" %>
<%
// 1) Create the objects needed to define axis characteristics.
// A StrokeLineStyle is needed to define line characteristics
// for both axes
StrokeLineStyle lineStyle=new StrokeLineStyle(
StrokeLineStyle.SASGRAPH_LINE01,
Color.red,
new BaseLength(3, "pt"),
GraphConstants.TRUE);
// An AxisModel is needed to suppress the axis label and define
// a line style and tick characteristics for the Response axis
AxisModel rAxis = new AxisModel();
rAxis.setLabel("");
rAxis.setAxisLineStyle(lineStyle);
rAxis.setContinuousMajorTickPositionPolicy(
GraphConstants.TICK_POSITION_INTERVAL);
rAxis.setContinuousMajorTickInterval(200);
rAxis.getMinorTickStyle().getLineStyle()
.setVisibilityPolicy(GraphConstants.FALSE);
// 2) Use the WaterfallChart to set the axis definitions on the chart
// Set the line color on the Category axis
waterfallChart.getGraphModel().getCategoryAxisModel()
.setAxisLineStyle(lineStyle);
// Set the AxisModel on the Response axis
waterfallChart.getGraphModel().setResponseAxisModel(rAxis);
// Create a data model and attach the data source
WaterfallChartTableDataModel dataModel=
new WaterfallChartTableDataModel();
dataModel.setModel(dataTable);
// Assign the variable roles and sort category values in descending order
dataModel.setCategoryVariable(
new ClassificationVariable("Id", GraphConstants.SORT_DESCENDING));
// Assign the Response variable role and apply the NLMNLUSD format so
// that Transaction amounts in the output are displayed in an
// internationalized representation of US dollars.
dataModel.setResponseVariable(
new AnalysisVariable("TransactionQ1", "nlmnlusd"));
// Call the data model's setCategorySortVariable() method
// to sort bars according to the values of the response variable
dataModel.setCategorySortVariable(dataModel.getResponseVariable());
// Assign the data model to the WaterfallChart
waterfallChart.setDataModel(dataModel);
// Set a graph title
waterfallChart.getTitle1().setText("BIP Waterfall Chart");
// Set HTTP-specific response and request functionality
waterfallChart.setResponse(response);
waterfallChart.setRequest(request);
// Set a graph size and write the chart to the display
waterfallChart.setWidth(600);
waterfallChart.setHeight(450);
waterfallChart.write(out);
%>