<%// MultipleY Variables:%>


<%
// To plot mutliple Y variables by the same X variable, add the 
// Y variables to a PlotVariableList, and then assign the Y role
// to that list rather than to an individual variable.
//
// Optionally, you can modify the Y axis and specify labels.
// This sample also disables markers and enables plot interpolation.
%>

<%@page import="com.sas.models.SimpleTable,
        com.sas.swing.models.TableModelAdapter,
        com.sas.servlet.tbeans.graphics.html.LinePlot,
        com.sas.graphics.components.lineplot.LinePlotTableDataModel,
        com.sas.graphics.components.PlotVariable,
        com.sas.graphics.components.PlotVariableList"
%>

<%
  // 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);

  // Create a data model and attach the data source to it
     LinePlotTableDataModel linePlotDataModel=
        new LinePlotTableDataModel(tma);

  // Define multiple X variables
     PlotVariable oneX=new PlotVariable("x1");

  // Define multiple Y variables
     PlotVariableList multiY=new PlotVariableList(
        new PlotVariable[] {
           new PlotVariable("y1"),
              new PlotVariable("y2")
        } );

  // Assign the X and Y variable roles
     linePlotDataModel.setXVariable(oneX);
     linePlotDataModel.setYVariable(multiY);

  // Assign the data model to the LinePlot
     linePlot.setDataModel(linePlotDataModel);

  // Set a title
     linePlot.getTitle1().setText("Multiple Plot Variables");

  // Set HTTP-specific response and request functionality
     linePlot.setResponse(response);
     linePlot.setRequest(request);

  // Write the chart to the display
     linePlot.write(out);
%>