// Error Values:

    // To use error values in a plot, specify multiple columns on the
    // PlotVariable(s) used in the plot. The first specified column
    // is used for the variable's assigned roll, the second for the
    // high errors, and the third for the low errors.

    import java.awt.BorderLayout;
    import javax.swing.JApplet;
    import javax.swing.table.DefaultTableModel;
    import com.sas.graphics.components.PlotVariable;
    import com.sas.graphics.components.scatterplot.ScatterPlot;
    import com.sas.graphics.components.scatterplot.ScatterPlotModel;
    import com.sas.graphics.components.scatterplot.ScatterPlotTableDataModel;
    import com.sas.graphics.components.NoteModel;

    public class ErrorValues extends JApplet {

      public void init() {

      // Create a ScatterPlot and a data model (data defined below)
         ScatterPlotTableDataModel dataModel = null;
         dataModel = new ScatterPlotTableDataModel(new TestData());

      // Create two PlotVariables with error values
         PlotVariable errX = new PlotVariable(
                            "S1"       // column for X role
                           , null      // format
                           , null      // informat
                           , "S1label" // label
                           , "S3"      // highColumnName
                           , "S3label" // highLabel
                           , "S4"      // lowColumnName
                           , "S4label" // lowLabel
                           );

         PlotVariable errY = new PlotVariable(
                            "S2"       // column for Y role
                           , null      // format
                           , null      // informat
                           , "S2label" // label
                           , "S3"      // highColumnName
                           , "S3label" // highLabel
                           , "S4"      // lowColumnName
                           , "S4label" // lowLabel
                           );

         dataModel.setXVariable(errX);
         dataModel.setYVariable(errY);

      // Create a scatter plot and get its model
         ScatterPlot scatterPlot = new ScatterPlot(dataModel);
         ScatterPlotModel graphModel = scatterPlot.getGraphModel();

      // For error lines, use color from the marker styles
         graphModel.setMatchErrorColor(true);

      // Set a graph title
         NoteModel title=scatterPlot.getTitle1();
         title.setText(
                  "Use Error Values");

      // Add the ScatterPlot to the Applet's content pane
         getContentPane().add(scatterPlot,BorderLayout.CENTER);
      }

      // Create the data source
         static private class TestData extends DefaultTableModel {

         private static Class  columnClass[]={ Double.class
                                             , Double.class
                                             , Double.class
                                             , Double.class
                                             };
         private static String columnNames[]={ "S1"
                                             , "S2"
                                             , "S3"
                                             , "S4"
                                             };
         public TestData() {
          super();
          Object data[][]={
                {new Double( 52),  new Double( 45),  new Double( 13),  new Double( 15)}
              , {new Double( 52),  new Double(-15),  new Double(  5),  new Double( 25)}
              , {new Double( 38),  new Double(  8),  new Double( 24),  new Double( 12)}
              , {new Double( 77),  new Double(-38),  new Double( 18),  new Double( 11)}
              , {new Double( 34),  new Double( 38),  new Double( 26),  new Double( 19)}
              , {new Double( 92),  new Double(-10),  new Double( 12),  new Double( 33)}
              , {new Double( 60),  new Double( 10),  new Double( 31),  new Double( 17)}
              , {new Double( 29),  new Double( 40),  new Double( 17),  new Double( 28)}

              , {new Double(-35),  new Double( 25),  new Double( 25),  new Double( 25)}
              , {new Double(-10),  new Double(  8),  new Double( 10),  new Double( 10)}
              , {new Double(-15),  new Double(-28),  new Double( 15),  new Double( 15)}
              , {new Double(-20),  new Double(  8),  new Double( 20),  new Double( 20)}
              , {new Double(-25),  new Double( 18),  new Double( 25),  new Double( 25)}
              , {new Double(-30),  new Double(  0),  new Double( 30),  new Double( 30)}
              , {new Double(-35),  new Double(-10),  new Double( 35),  new Double( 35)}

              , {new Double( 55),  new Double(  8),  new Double(-15),  new Double(-15)}
              , {new Double( 30),  new Double( 18),  new Double( 10),  new Double( 10)}
              , {new Double( 15),  new Double( -8),  new Double( 15),  new Double( 15)}
              , {new Double(  0),  new Double( 28),  new Double( 20),  new Double( 20)}
              , {new Double(-15),  new Double(-28),  new Double( 25),  new Double( 25)}
              , {new Double(-30),  new Double( 35),  new Double(-30),  new Double( 30)}
              , {new Double(-35),  new Double( -5),  new Double( 35),  new Double( 35)}
          };
          setDataVector(data, columnNames);
         }
         public Class getColumnClass(int column) {
          return columnClass[column];
         }
       }
    }