com.sas.graphics.components
Class GraphModel

com.sas.graphics.components.GraphModel
Direct Known Subclasses:
BarChartModel, BarLineChartModel, ESRIMapModel, GanttChartModel, LineChartModel, LinePlotModel, PieChartModel, RadarChartModel, ScatterPlotModel, TileChartModel, WaterfallChartModel

public class GraphModel

The GraphModel class contains general chart appearance preferences.

It is a base to be sub-classed by the specific chart model classes (such as BarChartModel), and therefore, contains only the properties common to all chart types.

Usage

In order to change a specific visual (non-data) attribute of a chart, a user retrieves a chart model from the chart component, and modifications of its properties, or contained model's properties will immediately affect the look of the chart.

For example:

  barChart.getBarChartModel().getBackgroundFillStyle().setFIllType(FillStyle.SOLID) 
  barChart.getBarChartModel().getBackgroundFillStyle().setColor(Color.gray) 
 
would change the color of the cell frame (if visible) to green right away.

Only properties common to all charts are stored in the GraphModel. These include:

Behavior

GraphModel contains all the common things needed by all chart types' models that extend it. So most of its job is to maintain the user-set properties.

Since:
SAS 9.1
See Also:
Graph, BarChartModel, PieChartModel, ScatterPlotModel

Constructor Summary
GraphModel()
           
 
Method Summary
 void apply(GraphModel theOtherModel)
          Utility method to convey properties contained in "theOtherModel" to this object.
 boolean equals(java.lang.Object obj)
          Determines whether another object is equal to this GraphModel.
 FillStyle getBackgroundFillStyle()
          Returns the FillStyle that holds the attributes for the background of the graph.
 BrushModel getBrushModel()
          Returns the Graph's brush model, a repository for brush appearance preferences.
 DataElementStyles getDataElementStyles()
          Returns the Styles used for data elements.
 DataTipModel getDataTipModel()
          Returns the visual properties applicable to the graph's frame line.
 LineStyle getFrameLineStyle()
          Returns the visual properties applicable to the graph's frame line.
 javax.swing.ImageIcon getLogo()
          Returns the logo.
 int getLogoJustification()
          Returns the justification of the logo within the graph area.
 int hashCode()
          Computes the hash code for this GraphModel.
 boolean isAntialiasedGraphics()
          Returns a flag indicating if the chart graphics will be drawn using antialiasing.
 boolean isAntialiasedText()
          Returns a flag indicating if the chart text will be drawn using antialiasing.
 void setAntialiasedGraphics(boolean newAntialiasedGraphics)
          This method sets if the chart will use anti-aliasing when rendering all graphics.
 void setAntialiasedText(boolean newAntialiasedText)
          This method sets if the chart will use anti-aliasing when rendering all text.
 void setBackgroundFillStyle(FillStyle newStyle)
          Set the FillStyle that holds the attributes for the background of the graph.
 void setBrushModel(BrushModel newBrushModel)
          Set the Graph's brush model, a repository for brush appearance preferences.
 void setDataElementStyles(DataElementStyles newStyles)
          Set the Styles used for data elements.
 void setDataTipModel(DataTipModel newDataTipModel)
          Sets the display properties applicable to the graph's interactive data tip.
 void setFrameLineStyle(LineStyle newFrameLineStyle)
          Sets the visual properties applicable to the graph's frame line.
 void setLogo(javax.swing.ImageIcon newLogo)
          Set an ImageIcon as a logo.
 void setLogoJustification(int newJustification)
          Set the justification of the logo within the graph area.
 
Methods inherited from class com.sas.graphics.components.ModelBase
addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, removePropertyChangeListener, setContainedModel
 

Constructor Detail

GraphModel

public GraphModel()
Method Detail

apply

public void apply(GraphModel theOtherModel)
Utility method to convey properties contained in "theOtherModel" to this object.

Contained "models" (i.e. properties that are subclasses of ModelBase) will in turn be called on to convey their properties to the like contained models in the other object. In that respect this can be considered a "tree" type copy.

This is a deep copy. Thus after the copy, mutable properties will not be shared by the two instances.

Parameters:
theOtherModel - properties applied to this instance

setAntialiasedText

public void setAntialiasedText(boolean newAntialiasedText)
This method sets if the chart will use anti-aliasing when rendering all text.

Anti-aliasing is a method of drawing where the edges are blended with the background, often producing smoother looking text.

The default is true.

Parameters:
newAntialiasedText - whether or not to draw text smoothly
See Also:
isAntialiasedText()

isAntialiasedText

public boolean isAntialiasedText()
Returns a flag indicating if the chart text will be drawn using antialiasing.

See Also:
setAntialiasedText(boolean)

setAntialiasedGraphics

public void setAntialiasedGraphics(boolean newAntialiasedGraphics)
This method sets if the chart will use anti-aliasing when rendering all graphics.

Anti-aliasing is a method of drawing where the edges are blended with the background, often producing smoother looking graphics.

The default is true.

Parameters:
newAntialiasedGraphics - whether or not to draw smooth graphics
See Also:
isAntialiasedGraphics()

isAntialiasedGraphics

public boolean isAntialiasedGraphics()
Returns a flag indicating if the chart graphics will be drawn using antialiasing.

See Also:
setAntialiasedGraphics(boolean)

setFrameLineStyle

public void setFrameLineStyle(LineStyle newFrameLineStyle)
                       throws java.lang.IllegalArgumentException
Sets the visual properties applicable to the graph's frame line.

Note: If the visibilityPolicy property is GraphConstatns.AUTOMATIC then the Graph will determine whether or not to display the frame based upon a combination of the data settings and the graph type. The frame emphasises the separation of each Graph Matrix cell (or group). A "cell" is that portion of the graph displaying data elements pertaining to a unique combination of row and column variable values.

Parameters:
newFrameLineStyle - the display attributes of the frame's line.
Throws:
java.lang.IllegalArgumentException - if newFrameLineStyle is null.
See Also:
getFrameLineStyle()

getFrameLineStyle

public LineStyle getFrameLineStyle()
Returns the visual properties applicable to the graph's frame line.

Returns:
the display attributes of the frame's line.
See Also:
setFrameLineStyle(com.sas.graphics.components.LineStyle)

setDataTipModel

public void setDataTipModel(DataTipModel newDataTipModel)
                     throws java.lang.IllegalArgumentException
Sets the display properties applicable to the graph's interactive data tip.

Parameters:
newDataTipModel - the display attributes applicable to the data tip.
Throws:
java.lang.IllegalArgumentException - if newDataTipModel is null.
See Also:
getDataTipModel()

getDataTipModel

public DataTipModel getDataTipModel()
Returns the visual properties applicable to the graph's frame line.

Returns:
the display attributes of the frame's line.
See Also:
setDataTipModel(com.sas.graphics.components.DataTipModel)

setDataElementStyles

public void setDataElementStyles(DataElementStyles newStyles)
                          throws java.lang.IllegalArgumentException
Set the Styles used for data elements.

Parameters:
newStyles - the data element attributes
Throws:
java.lang.IllegalArgumentException - if newStyles is null.
See Also:
getDataElementStyles(), DataElementStyles.apply(com.sas.graphics.components.DataElementStyles)

getDataElementStyles

public DataElementStyles getDataElementStyles()
Returns the Styles used for data elements.

Returns:
DataElementStyles - attributes to apply to data elements.
See Also:
setDataElementStyles(com.sas.graphics.components.DataElementStyles)

setBackgroundFillStyle

public void setBackgroundFillStyle(FillStyle newStyle)
                            throws java.lang.IllegalArgumentException
Set the FillStyle that holds the attributes for the background of the graph.

Parameters:
newStyle - the background display attributes
Throws:
java.lang.IllegalArgumentException - if newStyle is null.
See Also:
getBackgroundFillStyle(), FillStyle.apply(com.sas.graphics.components.FillStyle)

getBackgroundFillStyle

public FillStyle getBackgroundFillStyle()
Returns the FillStyle that holds the attributes for the background of the graph.

Returns:
FillStyle that defines the attributes for the graph background.
See Also:
getBackgroundFillStyle()

setBrushModel

public void setBrushModel(BrushModel newBrushModel)
                   throws java.lang.IllegalArgumentException
Set the Graph's brush model, a repository for brush appearance preferences. The Graph's brush is available if a SelectionModel is set on the Graph's DataModel. To brush mouse click down and drag to create the selection brush. Click inside the brush area and drag to move the brush. Ctrl-drag cause the previously selected points to remain selected.

Parameters:
newBrushModel - - the new brush appearance properties
Throws:
java.lang.IllegalArgumentException - if newBrushModel is null.
See Also:
getBrushModel()

getBrushModel

public BrushModel getBrushModel()
Returns the Graph's brush model, a repository for brush appearance preferences.

Returns:
com.sas.graphics.components.BrushModel the brush appearance properties
See Also:
setBrushModel(com.sas.graphics.components.BrushModel)

setLogo

public void setLogo(javax.swing.ImageIcon newLogo)
Set an ImageIcon as a logo.

Parameters:
newLogo - - the new logo
See Also:
getLogo()

getLogo

public javax.swing.ImageIcon getLogo()
Returns the logo.

Returns:
the logo
See Also:
setLogo(javax.swing.ImageIcon)

setLogoJustification

public void setLogoJustification(int newJustification)
                          throws java.lang.IllegalArgumentException
Set the justification of the logo within the graph area. The default value is javax.swing.SwingConstants.SOUTH_EAST.
    Valid values are:
       javax.swing.SwingConstants.SOUTH_EAST,
       javax.swing.SwingConstants.SOUTH_WEST,
       javax.swing.SwingConstants.NORTH_EAST,
       javax.swing.SwingConstants.NORTH_WEST
 

Parameters:
newJustification - the location where the logo (if assigned) will appear
Throws:
java.lang.IllegalArgumentException - if an invalid value is passed in.
See Also:
getLogoJustification()

getLogoJustification

public int getLogoJustification()
Returns the justification of the logo within the graph area.

Returns:
the location where the logo (if assigned) will appear
See Also:
setLogoJustification(int)

equals

public boolean equals(java.lang.Object obj)
Determines whether another object is equal to this GraphModel.

The result is true if and only if the argument is not null and is a GraphModel object that has the same property values as this object.

Overrides:
equals in class ModelBase
Parameters:
obj - the object to test for equality with this GraphModel
Returns:
true if the objects are the same ; false otherwise.

hashCode

public int hashCode()
Computes the hash code for this GraphModel.

Overrides:
hashCode in class ModelBase
Returns:
a hash code value for this object.



Copyright © 2009 SAS Institute Inc. All Rights Reserved.