<%// MultipleResponseVars:%>


<%
// To plot mutliple Response variables by the same Category variable, add the 
// Response variables to a AnalysisVariableList, and then assign the Response role
// to that list rather than to an individual variable.
//
// Optionally, you can modify the Response 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.LineChart,
        com.sas.graphics.components.linechart.LineChartTableDataModel,
        com.sas.graphics.components.AnalysisVariable,
        com.sas.graphics.components.AnalysisVariableList,
        com.sas.graphics.components.ClassificationVariable"
%>
<%
  // Create a LineChart instance
     LineChart lineChart = new LineChart();
  // 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
     LineChartTableDataModel dataModel=
        new LineChartTableDataModel(tma);


  // Assign the Category variable role
     dataModel.setCategoryVariable(
        new ClassificationVariable("x1"));
             
  // Define multiple Response variables
     AnalysisVariableList multiResponse=new AnalysisVariableList(
        new AnalysisVariable[] {
           new AnalysisVariable("y1"),
           new AnalysisVariable("y2")
        } );
               
  // Assign the Response variable roles
     dataModel.setResponseVariable(multiResponse);

  // Assign the data model to the LineChart
     lineChart.setDataModel(dataModel);

  // Set a title
     lineChart.getTitle1().setText("Multiple Response Variables");

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

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