<%// ChangeAxis:%>
<%
// A graph's display properties (axis characteristics, orientation, and
// so on) are general properties that are defined in the graph's model.
// Thus, to change a bar chart's axis characteristics,
// 1) Get the LineChart's graph model
// 2) Set the axis characteristics through the LineChartModel
%>
<%@page import="com.sas.models.SimpleTable,
com.sas.swing.models.TableModelAdapter,
com.sas.servlet.tbeans.graphics.html.LineChart,
com.sas.graphics.components.AnalysisVariable,
com.sas.graphics.components.ClassificationVariable,
com.sas.graphics.components.GraphConstants,
com.sas.graphics.components.linechart.LineChartTableDataModel,
com.sas.graphics.components.linechart.LineChartModel"
%>
<%
// Create a LineChart instance
LineChart lineChart = new LineChart();
// 1) Get the LineChart's graph model
LineChartModel lineChartModel=lineChart.getGraphModel();
// 2) Use the model to set the tick position policy to interval, then set the interval.
lineChartModel.getResponseAxisModel().setContinuousMajorTickPositionPolicy(
GraphConstants.TICK_POSITION_INTERVAL);
lineChartModel.getResponseAxisModel().setContinuousMajorTickInterval(5);
// Create a simple SAS table and add data to it
SimpleTable table = new SimpleTable();
%>
<%@ include file="SampleData.jsp" %>
<%
// Convert a simple SAS table to a simple Java Swing table
TableModelAdapter tma = new TableModelAdapter(table);
tma.setFormattedDataUsed(false);
// Create a data model and attach the data source to it
LineChartTableDataModel lineChartDataModel=
new LineChartTableDataModel(tma);
// Assign the Category and Response variable roles
lineChartDataModel.setCategoryVariable(
new ClassificationVariable("Month"));
lineChartDataModel.setResponseVariable(
new AnalysisVariable("Temp"));
// Assign the data model to the LineChart
lineChart.setDataModel(lineChartDataModel);
// Set a title
lineChart.getTitle1().setText("Raleigh Monthly Temperatures");
// Set HTTP-specific response and request functionality
lineChart.setResponse(response);
lineChart.setRequest(request);
// Write the chart to the display
lineChart.write(out);
%>