// ChangeAxis:

    // A graph's display properties (axis characteristics, orientation, and
    // so on) are general properties that are defined in the graph's model.
    // Thus, to change an AreaBarChart's axis characteristics,
    //    1) Create an AxisModel and any other objects needed to define
    //       axis characteristics (line style, tick intervals, ...)
    //    2) Use the AreaBarChart to set the axis definitions on the chart
    // This example creates a StrokeLineStyle to define a
    // 3pt solid red line for both the Height and Width axes.
    // It creates an AxisModel to suppress the axis label and define
    // a line style and tick characteristics for the Width axis.

       import com.sas.graphics.components.areabarchart.AreaBarChart;
       import com.sas.graphics.components.areabarchart.AreaBarChartTableDataModel;
       import com.sas.graphics.components.AnalysisVariable;
       import com.sas.graphics.components.ClassificationVariable;
       import com.sas.graphics.components.barchart.BarChartModel;
       import com.sas.graphics.components.AxisModel;
       import com.sas.graphics.components.GraphConstants;
       import com.sas.graphics.components.StrokeLineStyle;
       import com.sas.measures.BaseLength;

       import javax.swing.table.DefaultTableModel;
       import java.awt.BorderLayout;
       import java.awt.Color;
       import java.awt.Container;
       import java.awt.event.WindowAdapter;
       import java.awt.event.WindowEvent;
       import javax.swing.JFrame;
       import javax.swing.JPanel;

       public class ChangeAxis extends JPanel  {
         private ChangeAxis  theApp;
         public ChangeAxis () {
            setLayout(new BorderLayout());

         // Create an AreaBarChart and a data source
            AreaBarChart areaBarChart=new AreaBarChart();
            SampleData dataTable=new SampleData();

         // 1) Create the objects needed to define axis characteristics.
         // A StrokeLineStyle is needed to define line characteristics
         // for both axes
            StrokeLineStyle lineStyle=new StrokeLineStyle(
              StrokeLineStyle.SASGRAPH_LINE01,
              Color.red,
              new BaseLength(3, "pt"),
              GraphConstants.TRUE);

         // An AxisModel is needed to suppress the axis label and define
         // a line style and tick characteristics for the Response axis
            AxisModel rAxis = new AxisModel();
            rAxis.setLabel("");
            rAxis.setAxisLineStyle(lineStyle);
            rAxis.setContinuousMajorTickPositionPolicy(
              GraphConstants.TICK_POSITION_INTERVAL);
            rAxis.setContinuousMajorTickInterval(40);
            rAxis.getMinorTickStyle().getLineStyle()
             .setVisibilityPolicy(GraphConstants.FALSE);

         // 2) Use the AreaBarChart to set the axis definitions on the chart

         // Set the line color on the Height axis
            areaBarChart.getGraphModel().getHeightAxisModel()
             .setAxisLineStyle(lineStyle);

         // Set the AxisModel on the Width axis
            areaBarChart.getGraphModel().setWidthAxisModel(rAxis);

         // Create a data model and attach the data source
            AreaBarChartTableDataModel dataModel=
                      new AreaBarChartTableDataModel();
            dataModel.setModel(dataTable);

         // Assign variable roles to appropriate variables
            dataModel.setCategoryVariable(
                      new ClassificationVariable("Group"));

         // Create Analysis variables that calculate a mean
            AnalysisVariable h=new AnalysisVariable(
              "Height"                        // column for Height role
              ,GraphConstants.STATISTIC_MEAN    // statistic to calculate
            );
            AnalysisVariable w=new AnalysisVariable(
              "Weight"                        // column for Width role
              ,GraphConstants.STATISTIC_MEAN    // statistic to calculate
            );
         // Assign the Analysis variables to the data model
            dataModel.setHeightVariable(h);
            dataModel.setWidthVariable(w);

         // Assign the data model to the AreaBarChart
            areaBarChart.setDataModel(dataModel);

         // Set a graph title
            areaBarChart.getTitle1().setText("Change AreaBarChart Axes");
            add(areaBarChart, BorderLayout.CENTER);
          }
       // Create the data source
          static private class SampleData extends DefaultTableModel {
            private static Class  columnClass[]={String.class, String.class,
                                                 Double.class, Double.class};
            private static String columnNames[]={"Group","Age","Height","Weight"};
              public SampleData() {
    	    super();
                Object data[][] = {
                 { "Group 1", new String("y"+13), new Double(56.5), new Double(84)    },
                 { "Group 1", new String("y"+12), new Double(50.5), new Double(98)    },
                 { "Group 1", new String("y"+11), new Double(49),   new Double(50.5)  },
                 { "Group 1", new String("y"+12), new Double(46.3), new Double(77)    },
                 { "Group 1", new String("y"+12), new Double(53),   new Double(96.5)  },
                 { "Group 2", new String("y"+14), new Double(62.8), new Double(102.5) },
                 { "Group 2", new String("y"+16), new Double(70),   new Double(140)   },
                 { "Group 2", new String("y"+14), new Double(59.5), new Double(102)   },
                 { "Group 3", new String("y"+15), new Double(62),   new Double(112.5) },
                 { "Group 2", new String("y"+14), new Double(64.3), new Double(90)    },
                 { "Group 3", new String("y"+15), new Double(66.5), new Double(112)   },
                 { "Group 1", new String("y"+12), new Double(59),   new Double(99.5)  },
                 { "Group 1", new String("y"+13), new Double(62.5), new Double(84)    },
                 { "Group 1", new String("y"+12), new Double(64.8), new Double(128)   },
                 { "Group 1", new String("y"+12), new Double(57.3), new Double(83)    },
                 { "Group 1", new String("y"+11), new Double(57.5), new Double(85)    },
                 { "Group 3", new String("y"+15), new Double(77),   new Double(133)   },
                 { "Group 3", new String("y"+15), new Double(66.5), new Double(112)   },
                 { "Group 2", new String("y"+14), new Double(63.5), new Double(102.5) },
                 { "Group 3", new String("y"+16), new Double(72),   new Double(150)   }
                };
                setDataVector(data, columnNames);
              }
              public Class getColumnClass(int column) {
    	    return columnClass[column];
    	  }
          }
          public static void main(String[] args) {
          	  JFrame frame = new JFrame("BIP Graph Sample");
          	  Container container = frame.getContentPane();
              container.setLayout(new BorderLayout());
              container.setBackground(Color.white);

              JPanel bipPanel = new JPanel();
              bipPanel.setLayout(new BorderLayout());
              ChangeAxis  bipGraphSample = new ChangeAxis ();

              bipPanel.add(bipGraphSample, BorderLayout.CENTER);
              container.add(bipPanel, BorderLayout.CENTER);

              frame.setSize(600,450);
              frame.addWindowListener(new WindowAdapter() {
                  public void windowClosing(WindowEvent e) {
                         System.exit(0);
                  }
              } );
              frame.pack();
              frame.setVisible(true);
          }
       }