com.sas.servlet.tbeans.graphics
Class BaseScatterPlot

com.sas.servlet.tbeans.graphics.BaseScatterPlot
All Implemented Interfaces:
ActionProviderViewInterface, HttpActionProviderInterface, HttpActionProviderViewInterface, com.sas.beans.PropertyChangeSource, com.sas.lang.ObjectDataInterface, com.sas.servlet.tbeans.features.FeatureListInterface, RenderableInterface, TransformationInterface, com.sas.util.WriteToPrintWriterInterface, java.io.Serializable
Direct Known Subclasses:
ScatterPlot

public class BaseScatterPlot

The ScatterPlot is a Swing component that uses a ScatterPlotDataModel (data handle) and a ScatterPlotModel (display properties) to produce markers with different shapes, sizes and colors one for each data point. These markers may be connected to each other.

Data

The number and arrangement of data elements (i.e. markers and lines), axes and legend is determined by the ScatterPlotDataModel (assigned via the setDataModel method) which provides a handle to data and associated mapping properties. To illustrate the ScatterPlotTableDataModel is used to assign a javax.swing.table.TableModel along with a collection of variable properties to define the data column mapping onto the graph. The ScatterPlotOLAPDataModel is used to assign OLAP data via a com.sas.storage.olap.OLAPDataSetInterface.

Display Properties

The ScatterPlotModel properties define the display appearance. The ScatterPlotModel contains ScatterPlot specific properties, common graph properties and a collection of contained models (which provide display properties for sub-portions of the graph such as the legend). The ScatterPlot guarantees a non-null ScatterPlotModel via the getGraphModel method. Passing a null parameter to the ScatterPlot's setGraphModel method triggers an IllegalArgumentException. The ScatterPlotModel properties can be modified directly.

For example:

 ScatterPlot scatterPlot = new ScatterPlot();
 ScatterPlotModel scatterPlotModel = scatterPlot.getGraphModel();

 // Assign background color
 scatterPlotModel.setBackgroundFillStyle(new FillStyle(Color.lightGray));

 // Assign data element outline color
 scatterPlotModel.getDataElementStyles().getOutlineLineStyle().setColor(Color.yellow);

 // Assign a filled square marker.
 com.sas.graphics.components.MarkerStyle[] markerStyles = scatterPlotModel.getDataElementStyles().getMarkerStyles();
 markerStyle[0].setSymbol(com.sas.graphics.components.MarkerStyle.SQUARE_FILLED);
 

However it may be simpler to modify the properties indirectly by applying a GraphStyle via the applyGraphStyle method. The ScatterPlotModel allows for a high degree of control over the ScatterPlot's appearance. Because of the large number of display properties and the repetitive nature of some of the properties (for example: there are text style properties for the values text in the legend, x axis, y axis and data element values) applying a GraphStyle on the ScatterPlot may be the simplest way to obtain the desired results. A GraphStyle is a collection of graph properties that can be applied to any graph. Several pre-defined GraphStyles are provided and can be used as is or tweaked to provide the desired presentation. Applying a GraphStyle on a ScatterPlot will modify some of the ScatterPlotModel properties.

See Also:
Serialized Form

Constructor Summary
BaseScatterPlot()
          Construct a ScatterPlot applying the default GraphStyle (GraphStyle.CONVENTION_STYLE).
 
Method Summary
 void applyColorScheme(ColorScheme scheme)
          Apply a color scheme on this Graph.
 void applyGraphStyle(GraphStyle graphStyle)
          Apply the display properties in the GraphStyle to the ScatterPlot.
 ScatterPlotModel getGraphModel()
          Returns the ScatterPlotModel that encapsulates most of the ScatterPlot's display properties.
 PlotImageMapInfo getImageMapInfo()
          
The ScatterPlotImageMapInfo class encapsulates the mapping of regions associated with marker and line elements, labels (for both axes and legends) and values (for both axes and legends) as projected onto the display area along with their associated data.
 void setDataModel(ScatterPlotDataModel newDataModel)
          Sets the ScatterPlotDataModel which provides a handle to the data along with any associated mapping properties to define the number and arrangement of data elements (i.e. markers and lines), legend and axes.
 void setGraphModel(ScatterPlotModel newScatterPlotModel)
          Sets a ScatterPlotModel to define most of the ScatterPlot's display properties.
 
Methods inherited from class com.sas.servlet.tbeans.BaseActionTransformation
dispose, getActionProvider, getActionSupportType, getUniqueId, isActionVisible, listActionTypes, listAreaTypes, setActionProvider, setActionSupportType, setActionVisible, setUniqueId, write
 
Methods inherited from class com.sas.servlet.tbeans.BaseTransformation
addPropertyChangeListener, addPropertyChangeListener, cleanUpResources, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getCustomAttributes, getDescription, getId, getInputTransform, getLocale, getName, getObjectData, getObjectDataProperty, getOutputTransform, getRequest, getResponse, getTagEpilog, getTagProlog, hasListeners, isCleanUpResourcesOn, isVisible, removePropertyChangeListener, removePropertyChangeListener, setCleanUpResourcesOn, setCustomAttributes, setDescription, setId, setInputTransform, setLocale, setLocaleDependentProperties, setName, setObjectData, setObjectDataProperty, setOutputTransform, setRequest, setResponse, setTagEpilog, setTagProlog, setVisible, toString, write, write, write
 
Methods inherited from interface com.sas.actionprovider.HttpActionProviderViewInterface
getRequest, setRequest
 

Constructor Detail

BaseScatterPlot

public BaseScatterPlot()
Construct a ScatterPlot applying the default GraphStyle (GraphStyle.CONVENTION_STYLE).

Method Detail

setGraphModel

public void setGraphModel(ScatterPlotModel newScatterPlotModel)
                   throws java.lang.IllegalArgumentException
Sets a ScatterPlotModel to define most of the ScatterPlot's display properties. Modifying any ScatterPlotModel property triggers the ScatterPlot to update. The update is asynchronous and delayed so modifying multiple properties in quick succession will result in only a single update. Use the FullPaintInterface if greater control over the ScatterPlot's paint behavior is necessary.

Typically applyGraphStyle is used to modify the graphs display properties.

Parameters:
newScatterPlotModel - the model that encapsulates the ScatterPlot's display properties
Throws:
java.lang.IllegalArgumentException - if newScatterPlotModel is null.
See Also:
getGraphModel(), ScatterPlotModel.apply(com.sas.graphics.components.scatterplot.ScatterPlotModel), GraphStyle

getGraphModel

public ScatterPlotModel getGraphModel()
Returns the ScatterPlotModel that encapsulates most of the ScatterPlot's display properties.

Returns:
the ScatterPlotModel that encapsulates most of the ScatterPlot's display properties
See Also:
setGraphModel(com.sas.graphics.components.scatterplot.ScatterPlotModel), ScatterPlotModel.apply(com.sas.graphics.components.scatterplot.ScatterPlotModel)

setDataModel

public void setDataModel(ScatterPlotDataModel newDataModel)
Sets the ScatterPlotDataModel which provides a handle to the data along with any associated mapping properties to define the number and arrangement of data elements (i.e. markers and lines), legend and axes.

Any change in the ScatterPlotDataModel properties will cause the ScatterPlot to update. The update is asynchronous and delayed so modifying multiple properties in quick succession will result in only a single update. The FullPaintInterface can be used if greater control over the ScatterPlot's paint behavior is needed.

Note: Data value changes will also trigger ScatterPlot to update.

A valid ScatterPlotDataModel is required to draw a graph.

Parameters:
newDataModel - provides a handle to the data along with any associated mapping properties
See Also:
ScatterPlotTableDataModel, ScatterPlotOLAPDataModel

getImageMapInfo

public PlotImageMapInfo getImageMapInfo()

The ScatterPlotImageMapInfo class encapsulates the mapping of regions associated with marker and line elements, labels (for both axes and legends) and values (for both axes and legends) as projected onto the display area along with their associated data.

Returns:
the mapping of regions associated with marker and line elements, labels (for both axes and legends) and values (for both axes and legends) as projected onto the display area along with their associated data.

applyColorScheme

public void applyColorScheme(ColorScheme scheme)
Apply a color scheme on this Graph.

Overrides:
applyColorScheme in class com.sas.servlet.tbeans.graphics.BaseGraph
Parameters:
scheme - class containing a set of colors for the charts.

applyGraphStyle

public void applyGraphStyle(GraphStyle graphStyle)
Apply the display properties in the GraphStyle to the ScatterPlot. The use of this method is a convenient way to quickly and easily affect the ScatterPlot's appearance is strongly encouraged.

Some GraphStyle properties like the background fill style will be applied to the ScatterPlot's ScatterPlotModel (thus affecting the ScatterPlotAppearance). Other GraphStyle properties like the title1 text style will be applied to properties on other ScatterPlot models such as the ScatterPlot's title1 NoteModel in this example.

The GraphStyle enforces certain constraints that are not enforced on a Graph. For example the ScatterPlot supports setting different axis value text styles on different axes (via the ScatterPlotModel's category and response AxisModels) whereas a GraphStyle only supports a single axis value text style property. When a GraphStyle is applied to a ScatterPlot all of the ScatterPlot's axes values use the GraphStyle axis value setting (thus easily enforcing that all axes values are represented in the same font and color). The use of the GraphStyle allows for easier graph customizations while the ScatterPlot models allow for greated customizations when desired.

Modifying any of the properties in the GraphStyle after this call will have no affect on the ScatterPlot. Likewise modifying any ScatterPlot properties after this call will have no affect on the GraphStyle. This method simply conveys the properties in the GraphStyle onto the ScatterPlot properties.

A blind PropertyChangeEvent will be fired by the ScatterPlot after the apply is made.

No action will be taken if a null GraphStyle is passed in.

Overrides:
applyGraphStyle in class com.sas.servlet.tbeans.graphics.BaseGraph
Parameters:
graphStyle - the set of graph display properties



Copyright © 2009 SAS Institute Inc. All Rights Reserved.