<%// FillAreas:%>


<%
// When the Group role is used to generate multiple plot lines, the areas
// between the lines can be filled by calling the LinePlotModel's
// setFillAreaEnabled() method with the argument value true.
%>

<%@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.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
     PlotVariableList multiX=new PlotVariableList(
        new PlotVariable[] {
           new PlotVariable("x1"),
           new PlotVariable("x2"),
           new PlotVariable("x3")
        } );

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

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


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

  // Get the plot's graph model and enable filled areas
     LinePlotModel graphModel=linePlot.getGraphModel();
     graphModel.setFillAreaEnabled(true);


  // Set a title
     linePlot.getTitle1().setText("Fill the Plot Areas");

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

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