<%// ChangeMarker:%>
<%
// A graph's display properties (marker symbol, axis characteristics, and
// so on) are general properties that are defined in the graph's model. The
// marker characteristics are defined as MarkerStyles that are applied to
// the plot's DataElementStyles. Thus, the change the markers,
// 1) Get the LinePlot's graph model
// 2) Disable interpolation and enable marker display
// 3) Define a MarkerStyle for the plot markers
// 4) Set the MarkerStyle on the model's DataElementStyles
%>
<%@page import="com.sas.models.SimpleTable,
com.sas.swing.models.TableModelAdapter,
com.sas.servlet.tbeans.graphics.html.LinePlot,
com.sas.graphics.components.lineplot.LinePlotModel,
com.sas.graphics.components.lineplot.LinePlotTableDataModel,
com.sas.graphics.components.MarkerStyle,
com.sas.graphics.components.PlotVariable,
com.sas.graphics.util.Markers"
%>
<%
// Create a LinePlot instance
LinePlot linePlot = new LinePlot();
// Create a simple SAS table and add data to it
SimpleTable table = new SimpleTable();
%>
<%@ include file="TestData.jsp" %>
<%
// Convert a simple SAS table to a simple Java Swing table
TableModelAdapter tma = new TableModelAdapter(table);
tma.setFormattedDataUsed(false);
// 1) Get the LinePlot's graph model
LinePlotModel gModel=linePlot.getGraphModel();
// 2) Disable interpolation and enable marker display
gModel.setInterpolationEnabled(false);
gModel.setMarkerEnabled(true);
// 3) Define a MarkerStyle for the plot markers
MarkerStyle[] markerStyle=new MarkerStyle[] {
new MarkerStyle(MarkerStyle.SYMBOL_SQUARE_FILLED)};
// 4) Set the MarkerStyle on the model's DataElementStyles
gModel.getDataElementStyles().setMarkerStyles(markerStyle);
// Create a data model and attach the data source to it
LinePlotTableDataModel linePlotDataModel=
new LinePlotTableDataModel(tma);
// Assign the X and Y variable roles
linePlotDataModel.setXVariable(
new PlotVariable("x2"));
linePlotDataModel.setYVariable(
new PlotVariable("y2"));
// Assign the data model to the LinePlot
linePlot.setDataModel(linePlotDataModel);
// Set a title
linePlot.getTitle1().setText("Change Plot Markers");
// Set HTTP-specific response and request functionality
linePlot.setResponse(response);
linePlot.setRequest(request);
// Write the chart to the display
linePlot.write(out);
%>