com.sas.graphics.components.tilechart
Class TileChartModel

com.sas.graphics.components.tilechart.TileChartModel

public class TileChartModel

A TileChartModel encapsulates most of a TileChart's visual display properties. This contrasts with the TileChart's data model, which determines the number and organization of data elements (tiles) and the use of a legend.

A TileChartModel contains TileChart-specific properties, common graph properties, and a collection of models that control the appearance of the graph's peripheral elements, such as its legend.

A TileChartModel does not allow null values for properties in its contained models. Passing a null parameter to the set method for a contained model property results in an IllegalArgumentException. Guaranteeing non-null properties for a contained model simplifies access to the display properties and ensures that the TileChart's display state is unambiguous.

Topics:

Display Properties
Tile Lines
Tile Layouts
Color Palette
Detail Levels
Behavior
Samples:
Swing-based Samples
Servlet-based Samples

Since:
SAS 9.1
See Also:
Graph, GraphStyle, TileChart

Field Summary
static ConstantCollection LAYOUT
           
static int LAYOUT_FLOW
          LAYOUT_FLOW will decide on tile placement based on the sort order of the tiles, placing in a row until full then moving to the next row.
static int LAYOUT_GEOGRAPHIC
          PLACEMENT_GEOGRAPHIC will decide on tile placement based on the X and Y roles set on the data model.
static int LAYOUT_STANDARD
          LAYOUT_STANDARD will decide on tile placement based on the aspect ratio of the available space.
static int LAYOUT_TOGGLE
          
LAYOUT_TOGGLE will decide on tile placement based on the id level of the tile.
static java.lang.String RB_KEY
           
 
Constructor Summary
TileChartModel()
          default constructor
 
Method Summary
 void addHighlightModel(TileChartHighlightModel mod)
          Deprecated. use rulesContext property on DataModel
 void apply(TileChartModel theOtherObject)
          Utility method to convey properties contained in "theOtherObject" to this object.
 boolean equals(java.lang.Object obj)
          Determines whether another object is equal to this TileChartModel.
 int getColorPaletteType()
          Returns how the values of the color varaible are mapped to a corresponding color representation.
 int getDataLabelLevel()
          Returns the visible level number to be labeled with tile values.
 AdvancedTextStyle getDataLabelTextStyle()
          Returns the text properties used to label the tiles for the category level specified by setDataLabelLevel.
 TileChartHighlightModel getDataTipHighlightModel()
          Deprecated. use rulesContext property on DataModel
 int getDetailLevel()
          Returns the current number of category levels to be shown.
 TileChartHighlightModel[] getHighlightModelList()
          Deprecated. use rulesContext property on DataModel
 int getLayoutType()
          Returns the current tile layout of the tile chart.
 LegendModel getLegendModel()
          Returns the TileChart's legend model which is a compilataion of legend appearance preferences.
 java.util.ArrayList getLevLabels()
          Fetches the array of menu entries.
 double getMaximumColorValue()
           
 double getMinimumColorValue()
           
 java.lang.String getOtherLabel()
          Fetches the string used to label any composited, other tiles.
 double getOtherThreshold()
          Fetches the percentage used to calculate 'other' tiles.
 LineStyle getOutlineLineStyle(int level)
          Returns the line style of the tile outline for the specified category level.
 TextStyle getStatusLineTextStyle()
          Returns the base TextStyle used for the status line
 AdvancedTextStyle getTileLabelStyle(int level)
          Deprecated. Use getDataLabelLevel and getDataLabelTextStyle
 java.lang.String[] getWebLabels()
          Fetches the array of menu entries.
 java.lang.String[] getWebLinks()
          Fetches the array of web "action" URLs.
 int hashCode()
          Computes the hash code for this TileChartModel.
 boolean isColorByVisibleTiles()
          Should the color palette be defined by the color range of the current data view?
 boolean isColorVariableNumeric()
           
 boolean isDiscreteCategorization()
           
 boolean isDiscreteColorVariable()
           
 void putOutlineLineStyle(LineStyle style, int level)
          Sets the line properties of the tile outline for the specified category level.
 void removeHighlightModel(java.lang.String name)
          Deprecated. use rulesContext property on DataModel
 void removeHighlightModel(TileChartHighlightModel mod)
          Deprecated. use rulesContext property on DataModel
 void resetHighlightModel()
          Deprecated. use rulesContext property on DataModel
 void setColorByVisibleTiles(boolean lcr)
          If set to true, the color palette will range from the current view of the data's low color value to the current high color value.
 void setColorPaletteType(int newColorPaletteType)
          Sets how the values of the color varaible are mapped to a corresponding color representation.
 void setColorVariableNumeric(boolean isNumeric)
           
 void setDataLabelLevel(int level)
          Sets the visible level number to label with tile values.
 void setDataLabelTextStyle(AdvancedTextStyle style)
          Sets the text properties used to label the tiles for the category level specified by setDataLabelLevel.
 void setDataTipHighlightModel(TileChartHighlightModel dataTipHighlightModel)
          Deprecated. use rulesContext property on DataModel
 void setDefaultEdges()
           
 void setDefaultTileLabels()
           
 void setDetailLevel(int level)
          Sets the number of category levels to be shown.
 void setDiscreteCategorization(boolean b)
           
 void setDiscreteColorVariable(boolean b)
           
 void setLayoutType(int newPlacement)
          Sets the placement method of the tile slices.
 void setLegendModel(LegendModel newModel)
          Sets the TileChart's legend model, a compilataion of legend appearance preferences.
 void setLevLabels(java.util.ArrayList levLabels)
           
 void setMaximumColorValue(double maxColorVal)
           
 void setMinimumColorValue(double minColorVal)
           
 void setOtherLabel(java.lang.String newOtherLabel)
          Sets the label to be used to indicate composited, other tiles, if they are set to be displayed, and are needed.
 void setOtherThreshold(double newOtherThreshold)
          Sets the value in percent where smaller tiles will be compositied to create an 'other' tile.
 void setStatusLineTextStyle(TextStyle newStyle)
          Sets the TextStyle used for the status line.
 void setTileLabelStyle(AdvancedTextStyle style, int level)
          Deprecated. Use setDataLabelLevel and setDataLabelTextStyle
 void setWebLabels(java.lang.String[] webLabels)
          Sets the set of items to be used as the menu entries.
 void setWebLinks(java.lang.String[] webLinks)
          Sets the set of items to be used as the menu "action" URLs.
 
Methods inherited from class com.sas.graphics.components.GraphModel
apply, getBackgroundFillStyle, getBrushModel, getDataElementStyles, getDataTipModel, getFrameLineStyle, getLogo, getLogoJustification, isAntialiasedGraphics, isAntialiasedText, setAntialiasedGraphics, setAntialiasedText, setBackgroundFillStyle, setBrushModel, setDataElementStyles, setDataTipModel, setFrameLineStyle, setLogo, setLogoJustification
 
Methods inherited from class com.sas.graphics.components.ModelBase
addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, removePropertyChangeListener, setContainedModel
 

Field Detail

RB_KEY

public static final java.lang.String RB_KEY
See Also:
Constant Field Values

LAYOUT_STANDARD

public static final int LAYOUT_STANDARD
LAYOUT_STANDARD will decide on tile placement based on the aspect ratio of the available space. Tiles may end up horizontally or vertically oriented regardless of their id level. This is also known as squarified since the tiles are placed in a manner to keep them as close to square as possible.

See Also:
setLayoutType(int), getLayoutType(), Constant Field Values

LAYOUT_TOGGLE

public static final int LAYOUT_TOGGLE

LAYOUT_TOGGLE will decide on tile placement based on the id level of the tile. So all top level tiles might be horizontal, the next level id would then be vertical, and so on. This could cause very thin slivers for tiles which are more dificult to compare areas with.

See Also:
setLayoutType(int), getLayoutType(), Constant Field Values

LAYOUT_GEOGRAPHIC

public static final int LAYOUT_GEOGRAPHIC
PLACEMENT_GEOGRAPHIC will decide on tile placement based on the X and Y roles set on the data model. If neither X nor Y has been specified, standard placement will be used.

See Also:
setLayoutType(int), getLayoutType(), Constant Field Values

LAYOUT_FLOW

public static final int LAYOUT_FLOW
LAYOUT_FLOW will decide on tile placement based on the sort order of the tiles, placing in a row until full then moving to the next row. It uses a reading metaphor.

See Also:
setLayoutType(int), getLayoutType(), Constant Field Values

LAYOUT

public static final ConstantCollection LAYOUT
Constructor Detail

TileChartModel

public TileChartModel()
default constructor

Method Detail

apply

public void apply(TileChartModel theOtherObject)
Utility method to convey properties contained in "theOtherObject" to this object.
Note: 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.
Also Note: This is a deep copy. Thus after the copy, mutable properties will not be shared by the two instances.

Parameters:
theOtherObject - properties applied to this instance

setDefaultTileLabels

public void setDefaultTileLabels()

setDefaultEdges

public void setDefaultEdges()

setLegendModel

public void setLegendModel(LegendModel newModel)
                    throws java.lang.IllegalArgumentException
Sets the TileChart's legend model, a compilataion of legend appearance preferences. By default, the Tile chart displays a legend if a color variable has been specified.

Parameters:
newModel - the new repository for the legend display attributes
Throws:
java.lang.IllegalArgumentException - if newModel is null.
See Also:
getLegendModel(), LegendModel.apply(com.sas.graphics.components.LegendModel)

getLegendModel

public LegendModel getLegendModel()
Returns the TileChart's legend model which is a compilataion of legend appearance preferences. By default, the Tile chart displays a legend if a color role has been specified.

Returns:
properties of the chart's legend
See Also:
setLegendModel(com.sas.graphics.components.LegendModel)

setColorPaletteType

public void setColorPaletteType(int newColorPaletteType)
                         throws java.lang.IllegalArgumentException
Sets how the values of the color varaible are mapped to a corresponding color representation.
Valid values are:
To explain this mapping it is necessary to understand the graph's resulting "min" "max" and "baseline" values (i.e. the min, max and baseline values pertaining to the styleBy variable values). The LegendModel has 4 properties {minimum, maximum, baseline, symmetricEnabled} that can affect the graph's resulting min, max and baseline values. Typically the LegendModel's minimum and maximum values (default of Double.NaN) are not be specified and result in the graph computing the resulting min and max values from the styleBy variable data. However if the LegendModel's minimum and maximum values are specified then they override the graph's computed min and max values. Specifying a maximum or maximum on the LegendModel has the inherent risk of improperly defining the data range (i.e. this specified range not encompassing the styleBy variables data range). If this happens the specified range is still honored by the legend and any data values that extend beyond the specified range are colored by that color value mapped to the boundary which was breeched. For example if a user defined max value of 100 was specified then any data values greater than 100 would be mapped to the the same color as 100.
Note: a warning message is when rendering if on the LegendModel :
  • the minimum is specified and baseline is less than minimum
  • the maximum is specified and baseline is greater than maximum
  • the maximum is specified less than minimum

The LegendModel's baseline value (default of 0.0) is treated somewhat differently from maximum and minimum in determing the graph's resulting min/max range. The LegendModel's baseline value is treated as if it were a data value when the graph is computing its resulting min and max values. If the LegendModel's baseline value is set to Double.NaN then the graph's resulting baseline value is computed to be the midpoint of the resulting min/max range. Note: The LegendModel's baseline value may only affect the graphs resulting maximum if LegendModel's maximum has not been specified. Likewise baseline may affect the graphs resulting minimum if minimum has not been specified.
The LegendModel's symetricEnabled value (default of false) is only applicable when maximum and minimum have not been specified and baseline has been specified. If symmetricEnabled is true then the graph's computed min/max range will encompass the data range and be symetric about the baseline.

Applying colors to the resulting range:

A value of GraphConstants.COLOR_PALETTE_TWO_COLOR_CONTINUOUS indicates that the DataElementStyles' continuousFillTwoColor values are applied gradating the colors from min to max.

A value of GraphConstants.COLOR_PALETTE_THREE_COLOR_CONTINUOUS indicates that the DataElementStyles' continuousFillThreeColor values are applied gradating between the start and neutral colors from min to baseline and then gradate between the neutral and end colors from baseline to max.

A value of GraphConstants.COLOR_PALETTE_COLOR_SPECTRUM indicates that the DataElementStyles' continuousColorSpectrum values should be mapped to the corresponding data value. The color spectrum defines the mapping in percentages along a normalized range or 0.0 to 1.0. Note: Although the LegendModel's baseline value is still considered when deterining the resulting min/max range, the baseline value is not mapped to any specific color when using the DataElementStyles' continuousColorSpectrum.

Parameters:
newColorPaletteType - defines which set of colors to apply when the color variable has been assigned.
Throws:
java.lang.IllegalArgumentException - if newColorPaletteType is invalid.
See Also:
getColorPaletteType()

getColorPaletteType

public int getColorPaletteType()
Returns how the values of the color varaible are mapped to a corresponding color representation.

Returns:
the an indicator of which set of colors to apply when the color variable has been assigned.
See Also:
setColorPaletteType(int)

setDetailLevel

public void setDetailLevel(int level)
Sets the number of category levels to be shown. Defaults to the number of specified ID variables (full detail). If a number less than the number of available IDs, that many levels of ID variable will be shown as individual tiles, and lower detail will be summarized at the lowest visible level. The size summarizes as the sum, and the color uses a size-based color average (so larger tiles contribute more to a summarized color than small ones). If greater than the available number of IDs, all levels will be shown. This value is reset if the data model is changed in any way.

Parameters:
level - The desired level of detail
Throws:
java.lang.IllegalArgumentException - if detailLevel is < 1
See Also:
getDetailLevel()

getDetailLevel

public int getDetailLevel()
Returns the current number of category levels to be shown.

Returns:
the levels of detail
See Also:
setDetailLevel(int)

setTileLabelStyle

public void setTileLabelStyle(AdvancedTextStyle style,
                              int level)
Deprecated. Use setDataLabelLevel and setDataLabelTextStyle

Sets the text properties used to label the tiles for the specified category level. The level refers to the current set of visible levels, with 1 being the most general level.

Parameters:
style - The text properties of the tile labels
See Also:
getTileLabelStyle(int)

getTileLabelStyle

public AdvancedTextStyle getTileLabelStyle(int level)
Deprecated. Use getDataLabelLevel and getDataLabelTextStyle

Returns the text style used to label the tiles for the specified category level. The level refers to the current set of visible levels, with 1 being the most general level.

Returns:
text properties associated with the tile labels
See Also:
setTileLabelStyle(com.sas.graphics.components.AdvancedTextStyle, int)

setDataLabelLevel

public void setDataLabelLevel(int level)
Sets the visible level number to label with tile values. The level refers to the current set of visible levels, with 1 being the most general level.

Parameters:
level - data level to label (default of 1 is most general)
See Also:
getDataLabelLevel()

getDataLabelLevel

public int getDataLabelLevel()
Returns the visible level number to be labeled with tile values. The level refers to the current set of visible levels, with 1 being the most general level.

Returns:
data level to label (default of 1 is most general)
See Also:
setDataLabelLevel(int)

setDataLabelTextStyle

public void setDataLabelTextStyle(AdvancedTextStyle style)
Sets the text properties used to label the tiles for the category level specified by setDataLabelLevel.

Parameters:
style - The text properties of the tile labels
See Also:
getDataLabelTextStyle()

getDataLabelTextStyle

public AdvancedTextStyle getDataLabelTextStyle()
Returns the text properties used to label the tiles for the category level specified by setDataLabelLevel.

Returns:
The text properties of the tile labels
See Also:
setDataLabelTextStyle(com.sas.graphics.components.AdvancedTextStyle)

putOutlineLineStyle

public void putOutlineLineStyle(LineStyle style,
                                int level)
Sets the line properties of the tile outline for the specified category level. If none is specified, no outline will be used for tiles at that level. The level refers to the current set of visible levels, with 1 being the most general level. Level -1 is a special case meaning the lowest (most specific) level if no edge has been defined for the specific level number.

Parameters:
style - The line properties of the outline
See Also:
getOutlineLineStyle(int)

getOutlineLineStyle

public LineStyle getOutlineLineStyle(int level)
Returns the line style of the tile outline for the specified category level. The level refers to the current set of visible levels, with 1 being the most general level.

Returns:
line properties associated with the tile's outline
See Also:
putOutlineLineStyle(com.sas.graphics.components.LineStyle, int)

setColorVariableNumeric

public void setColorVariableNumeric(boolean isNumeric)

isColorVariableNumeric

public boolean isColorVariableNumeric()

setStatusLineTextStyle

public void setStatusLineTextStyle(TextStyle newStyle)
Sets the TextStyle used for the status line. This is more of a base style, since text varients are used to indicate element state. The bold version of the TextStyle indicates the levels currently being viewed. The italic (and underlined, link-style) version shows levels zoomed into. And the plain version indicates unseen data levels.

Parameters:
newStyle - The base TextStyle of the status line
See Also:
getStatusLineTextStyle()

getStatusLineTextStyle

public TextStyle getStatusLineTextStyle()
Returns the base TextStyle used for the status line

Returns:
base TextStyle to be used for status line
See Also:
setStatusLineTextStyle(com.sas.graphics.components.TextStyle)

setLayoutType

public void setLayoutType(int newPlacement)
Sets the placement method of the tile slices. This determines how the tiles are laid out within the root rectangle representing the total picture of the data.

Parameters:
newPlacement - The desired placement method of the tiles. Valid values are:
  • TileChartModel.LAYOUT_STANDARD
  • TileChartModel.LAYOUT_TOGGLE
  • TileChartModel.PLACEMENT_GEOGRAPHIC
  • TileChartModel.LAYOUT_FLOW
Throws:
java.lang.IllegalArgumentException - if an invalid value is specified
See Also:
getLayoutType(), LAYOUT_STANDARD, LAYOUT_TOGGLE, LAYOUT_GEOGRAPHIC, LAYOUT_FLOW

getLayoutType

public int getLayoutType()
Returns the current tile layout of the tile chart.

Returns:
the method used to place the tiles within the chart
See Also:
setLayoutType(int)

addHighlightModel

public void addHighlightModel(TileChartHighlightModel mod)
Deprecated. use rulesContext property on DataModel

Adds a highlightModel to the list of current highlights


removeHighlightModel

public void removeHighlightModel(TileChartHighlightModel mod)
Deprecated. use rulesContext property on DataModel

Removes a highlight model from list if existing


removeHighlightModel

public void removeHighlightModel(java.lang.String name)
Deprecated. use rulesContext property on DataModel

Removes a highlight model from list if existing by name


resetHighlightModel

public void resetHighlightModel()
Deprecated. use rulesContext property on DataModel

Emptys all highlight models from current highlight list


getHighlightModelList

public TileChartHighlightModel[] getHighlightModelList()
Deprecated. use rulesContext property on DataModel

Returns list of all current TileChartHighlightModel objects


getDataTipHighlightModel

public TileChartHighlightModel getDataTipHighlightModel()
Deprecated. use rulesContext property on DataModel

Returns:
Returns the dataTipHighlightModel.

setDataTipHighlightModel

public void setDataTipHighlightModel(TileChartHighlightModel dataTipHighlightModel)
Deprecated. use rulesContext property on DataModel

Parameters:
dataTipHighlightModel - The dataTipHighlightModel to set

setColorByVisibleTiles

public void setColorByVisibleTiles(boolean lcr)
If set to true, the color palette will range from the current view of the data's low color value to the current high color value. If false, the global high/low color values will be used. Global color gives consistancy between views, but can leave outer bands of the color palette unused when zoomed. The current view can be modified by using data zoom or setting a detail level.

Parameters:
lcr - boolean value indicating if local color range should be used
See Also:
isColorByVisibleTiles()

isColorByVisibleTiles

public boolean isColorByVisibleTiles()
Should the color palette be defined by the color range of the current data view?

Returns:
boolean indicating if local color range should be used
See Also:
setColorByVisibleTiles(boolean)

setOtherLabel

public void setOtherLabel(java.lang.String newOtherLabel)
Sets the label to be used to indicate composited, other tiles, if they are set to be displayed, and are needed.

Parameters:
newOtherLabel - String to use as label for other tiles
See Also:
getOtherLabel()

getOtherLabel

public java.lang.String getOtherLabel()
Fetches the string used to label any composited, other tiles.

Returns:
String used to label 'other' tiles
See Also:
setOtherLabel(java.lang.String)

setOtherThreshold

public void setOtherThreshold(double newOtherThreshold)
                       throws java.lang.IllegalArgumentException
Sets the value in percent where smaller tiles will be compositied to create an 'other' tile.

Parameters:
newOtherThreshold - percenage to set as other threshold
Throws:
java.lang.IllegalArgumentException - If other threshold is outside valid percentage range (0-100)
See Also:
getOtherThreshold()

getOtherThreshold

public double getOtherThreshold()
Fetches the percentage used to calculate 'other' tiles.

Returns:
percenage to be used as other threshold
See Also:
setOtherThreshold(double)

setWebLinks

public void setWebLinks(java.lang.String[] webLinks)
Sets the set of items to be used as the menu "action" URLs. Linking from a tile to a URL is supported with relational data. The webLabels array indicats what strings the menu will display, and the webLinks are the associated URLs. Both webLabels and webLinks can have tile-specific values data-substituted in the string. Data substitution uses the WebLinks role, set on the TileChartTableModel, which defines a Variable list. Each time a value such as "{&1}" is encountered in the webLabels or webLinks strings, the value of the webLink variable corresponding to the number will be substituted. This is a one-based operation, so the above example would place the first weblink variable into the string.

Parameters:
webLinks - Array of strings for use as menu "action" URLs
See Also:
getWebLinks(), setWebLabels(java.lang.String[])

getWebLinks

public java.lang.String[] getWebLinks()
Fetches the array of web "action" URLs.

Returns:
Array of strings for use as menu "action" URLs
See Also:
setWebLinks(java.lang.String[]), getWebLabels()

setWebLabels

public void setWebLabels(java.lang.String[] webLabels)
Sets the set of items to be used as the menu entries. Linking from a tile to a URL is supported with relational data. The webLabels array indicats what strings the menu will display, and the webLinks are the associated URLs. Both webLabels and webLinks can have tile-specific values data-substituted in the string. Data substitution uses the WebLinks role, set on the TileChartTableModel, which defines a Variable list. Each time a value such as "{&1}" is encountered in the webLabels or webLinks strings, the value of the webLink variable corresponding to the number will be substituted. This is a one-based operation, so the above example would place the first weblink variable into the string.

Parameters:
webLabels - Array of strings for use as menu entries
See Also:
getWebLabels(), setWebLinks(java.lang.String[])

setLevLabels

public void setLevLabels(java.util.ArrayList levLabels)

getLevLabels

public java.util.ArrayList getLevLabels()
Fetches the array of menu entries.

Returns:
Array of strings for use as menu entries
See Also:
setWebLabels(java.lang.String[]), getWebLinks()

getWebLabels

public java.lang.String[] getWebLabels()
Fetches the array of menu entries.

Returns:
Array of strings for use as menu entries
See Also:
setWebLabels(java.lang.String[]), getWebLinks()

equals

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

The result is true if and only if the argument is not null and is a TileChartModel object that has the same properties as this object.

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

hashCode

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

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

setMinimumColorValue

public void setMinimumColorValue(double minColorVal)

getMinimumColorValue

public double getMinimumColorValue()

setMaximumColorValue

public void setMaximumColorValue(double maxColorVal)

getMaximumColorValue

public double getMaximumColorValue()

setDiscreteColorVariable

public void setDiscreteColorVariable(boolean b)

isDiscreteColorVariable

public boolean isDiscreteColorVariable()

setDiscreteCategorization

public void setDiscreteCategorization(boolean b)

isDiscreteCategorization

public boolean isDiscreteCategorization()



Copyright © 2009 SAS Institute Inc. All Rights Reserved.