|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.sas.graphics.components.LegendModel
public class LegendModel
A LegendModel
contains the set of display properties applied to
a graph's legend. Changing LegendModel
property values will trigger
the associated graph to refresh its display.
LegendModel
via the graph's GraphModel
.
Typically, a graph is capable of displaying only a single legend in which case
the legend model is usually accessible via graph.getGraphModel().getLegendModel();
.
However, some graphs are capable of displaying multiple legends, in which case it becomes
necessary to locate the relevant LegendModel
by examining the
LegendModel
properties found within that graph's associated
GraphModel
. (ex. The ScatterPlot
can display a
legend for color values and a separate legend for shape values. The legend
responsible for identifying the color values is
scatterplot.getGraphModel().getColorLegendModel();
.
GanttChart
, this is always whereas for most other graph types
it is only when certain criteria have been established.
For instance a BarChart
will attempt to display a legend only when any of
the following have been satisfied: (1) multiple response variables have been
specified or (2) a subgroup variable has been specified or (3) a styleBy variable has been
specified. The LegendModel
's visible property is only applicable when the
graph is a state such that it will attempt to display a legend.
By default, legends use an automatic layout strategy enabling the the graph to determine how to best fit all the values and associated legend graphics within the provided space. Properties are available to allow the legend's display to be customised. However, when pressed for space, fitting strategies are engaged which will shrink fonts sizes, truncate legend values, etc. in an attempt to fit the legend display within the available space while continuing to allow the graph to be displayed. When the fitting strategies are engaged, that is when there is insufficient display space to accommodate the graph's preferred size, some user setting may be ignored or modified in an attempt to fit the legend. Sometimes there just isn't sufficient display space to accommodate both the graph and the legend, in which case, the legend is dropped from the display altogether. Typically this only happens when there is a rather small amount of available display space or when there is a large amount of values in the legend.
BarChartModel
,
PieChartModel
,
ScatterPlotModel
Constructor Summary | |
---|---|
LegendModel()
Default constructor. |
Method Summary | |
---|---|
void |
addEntryToLegendValuesIndexMap(java.lang.String keyStr,
java.lang.String valueStr)
This method can be used to add a key - value pair in the legendValuesIndexMap. |
void |
apply(LegendModel 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 LegendModel . |
int |
getActualCOLOR_BYLegendSize()
|
FillStyle |
getBackgroundFillStyle()
Returns the FillStyle used by the legend's background. |
double |
getBaseline()
Returns the baseline value which represents a data value color inflection point (only applicable to continuous color legends). |
java.lang.String[] |
getCategories()
Returns the array of Strings that will be used for the legend value text. |
boolean |
getFirstTimeColorVectorCOLOR_BY()
|
boolean |
getFirstTimeStringVectorCOLOR_BY()
|
LineStyle |
getFrameLineStyle()
Gets the visual properties applicable to the frame's line. |
boolean |
getIsFirstTime()
Getter method for the boolean member isFirstTime. |
int |
getLabelPlacement()
Returns the placement of the legend's label. |
java.util.LinkedHashMap |
getLegendValuesIndexMap()
The getter method for the member HashMap legendValuesIndexMap; |
double |
getMaximum()
Sets the the maximum value to represent on the legend (valid only for the continuous color legends). |
boolean |
getMilestoneMarkerFlag()
This is the getter method for the boolean member isMilestoneMarkerPresent which indicates whether the "Milestone" marker is present or not. |
int |
getMilestoneMarkerIndex()
This is the getter method for the integer member milestoneMarkerIndex which indicates the row index of the "Milestone" marker. |
double |
getMinimum()
Sets the the minimum value represented on the legend (only applicable to the continuous color legends). |
int |
getPlacement()
Returns the placement of the legend in relation to the chart. |
ShadowStyle |
getShadowStyle()
Returns the shadow style of the legend border. |
boolean |
getTargetMarkerFlag()
This is the getter method for the boolean member isTargetMarkerPresent which indicates whether the "Target" marker is present or not. |
int |
getTargetMarkerIndex()
This is the getter method for the integer member targetMarkerIndex which indicates the row index of the "Target" marker. |
java.lang.String |
getValueFromLegendValuesIndexMap(java.lang.String keyStr)
This method can be used to return a String index value for a key stored in the legendValuesIndexMap. |
int |
hashCode()
Computes the hash code for this LegendModel . |
boolean |
isDrillIconVisible()
Return if a drill-down icon should appear next to the subgroup label (if present). |
boolean |
isSymmetricEnabled()
Returns whether or not the legend range is symmetric about the baseline value (only applicable to continuous color legends and when the baseline value is a real number (i.e. not a Double.NaN)). |
void |
setActualCOLOR_BYLegendSize(int i)
setter method for setting the member actualCOLOR_BYLegendSize. |
void |
setBackgroundFillStyle(FillStyle newFillStyle)
Set the legend's background fill properties. |
void |
setBaseline(double baselineValue)
Sets the baseline value which represents a data value color inflection point (only applicable to continuous color legends). |
void |
setCategories(java.lang.String[] newValues)
Set the category string values for the legend entries. |
void |
setDrillIconVisible(boolean newVis)
Set if a drill-down icon should appear next to the subgroup label (if present). |
void |
setFirstTimeColorVectorCOLOR_BY(int i)
setter method for setting the member isFirstTimeColorVectorCOLOR_BY |
void |
setFirstTimeStringVectorCOLOR_BY(int i)
setter method for setting the member isFirstTimeStringVectorCOLOR_BY. |
void |
setFrameLineStyle(LineStyle newFrameLineStyle)
Sets the visual properties applicable to the frame's line. |
void |
setIsFirstTime(int i)
Setter method for the boolean member isFirstTime. |
void |
setLabelPlacement(int newPlacement)
Sets the placement of the legend's label within the legend frame. |
void |
setLegendValues(java.lang.String[] newValues)
This method is same as the above setCategories method except that this method does not call the firePropertyChange() method at the end. |
void |
setLegendValuesIndexMap(java.util.LinkedHashMap hm)
This method should be used only to read back the persisted legend index values. |
void |
setMaximum(double maxValue)
Sets the the maximum value to represent on the legend (only applicable to the continuous color legends). |
void |
setMilestoneMarkerFlag(boolean b)
This is the setter method for the boolean member isMilestoneMarkerPresent which indicates whether the "Milestone" marker is present or not. |
void |
setMilestoneMarkerIndex(int i)
This is the setter method for the integer member milestoneMarkerIndex which indicates the row index of the "Milestone" marker. |
void |
setMinimum(double minValue)
Sets the the minimum value to represent on the legend (only applicable to the continuous color legends). |
void |
setPlacement(int newPlacement)
Sets the placement of the legend in relation to the chart. |
void |
setShadowStyle(ShadowStyle newShadow)
Set the shadow attributes for the legend's shadow. |
void |
setSymmetricEnabled(boolean symmetry)
Sets whether or not the legend range is symmetric about the baseline value (only applicable to continuous color legends). |
void |
setTargetMarkerFlag(boolean b)
This is the setter method for the boolean member isTargetMarkerPresent which indicates whether the "Target" marker is present or not. |
void |
setTargetMarkerIndex(int i)
This is the setter method for the integer member targetMarkerIndex which indicates the row index of the "Target" marker. |
Methods inherited from class com.sas.graphics.components.ContentsModel |
---|
apply, getLabel, getLabelTextStyle, getValueTextStyle, isVisible, setLabel, setLabelTextStyle, setValueTextStyle, setVisible |
Methods inherited from class com.sas.graphics.components.ModelBase |
---|
addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, removePropertyChangeListener, setContainedModel |
Constructor Detail |
---|
public LegendModel()
Method Detail |
---|
public void apply(LegendModel theOtherObject)
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.
theOtherObject
- properties applied to this instancepublic void setLabelPlacement(int newPlacement) throws java.lang.IllegalArgumentException
This method is not applicable in conjunction with a continuous legend such as a legend showing a continuous color ramp which has no frame.
Valid values are:
newPlacement
- legend label placement specification
java.lang.IllegalArgumentException
- if an invalid value is passed in.getLabelPlacement()
public int getLabelPlacement()
setLabelPlacement(int)
public void setShadowStyle(ShadowStyle newShadow) throws java.lang.IllegalArgumentException
Note: The shadow style is ignored if the border is not visible.
newShadow
- the border's shadow attributes
java.lang.IllegalArgumentException
- if newShadow is null.getShadowStyle()
,
ShadowStyle.apply(com.sas.graphics.components.ShadowStyle)
public ShadowStyle getShadowStyle()
setShadowStyle(com.sas.graphics.components.ShadowStyle)
public void setCategories(java.lang.String[] newValues) throws java.lang.IllegalArgumentException
newValues
- an array of text strings for the legend to display.
java.lang.IllegalArgumentException
- if array is empty, any array element is null or has
duplicate string values.getCategories()
public void setLegendValues(java.lang.String[] newValues) throws java.lang.IllegalArgumentException
newValues
-
java.lang.IllegalArgumentException
public java.lang.String[] getCategories()
setCategories(java.lang.String[])
public void setMilestoneMarkerFlag(boolean b)
b
- public void setTargetMarkerFlag(boolean b)
b
- public boolean getMilestoneMarkerFlag()
public boolean getTargetMarkerFlag()
public void setMilestoneMarkerIndex(int i)
i
- public void setTargetMarkerIndex(int i)
i
- public int getMilestoneMarkerIndex()
public int getTargetMarkerIndex()
public java.util.LinkedHashMap getLegendValuesIndexMap()
public void setLegendValuesIndexMap(java.util.LinkedHashMap hm)
hm
- LinkedHashMap to be usedpublic void addEntryToLegendValuesIndexMap(java.lang.String keyStr, java.lang.String valueStr)
keyStr
- valueStr
- Value string found in the legendpublic java.lang.String getValueFromLegendValuesIndexMap(java.lang.String keyStr)
keyStr
-
public void setIsFirstTime(int i)
i
- public boolean getIsFirstTime()
public int getActualCOLOR_BYLegendSize()
public void setActualCOLOR_BYLegendSize(int i)
i
- public boolean getFirstTimeStringVectorCOLOR_BY()
public void setFirstTimeStringVectorCOLOR_BY(int i)
i
- public boolean getFirstTimeColorVectorCOLOR_BY()
public void setFirstTimeColorVectorCOLOR_BY(int i)
i
- public void setBackgroundFillStyle(FillStyle newFillStyle) throws java.lang.IllegalArgumentException
solidFillColor
.
This method is not applicable in conjunction with a continuous legend such as a legend showing a continuous color ramp which has no frame or background.
newFillStyle
- the legend background attributes
java.lang.IllegalArgumentException
- if newFillStyle is null.getBackgroundFillStyle()
,
FillStyle.apply(com.sas.graphics.components.FillStyle)
public FillStyle getBackgroundFillStyle()
setBackgroundFillStyle(com.sas.graphics.components.FillStyle)
public void setPlacement(int newPlacement)
Valid values are:
A value of GraphConstants.PLACEMENT_AUTOMATIC (the default value) allows the chart to place the legend where it thinks is aesthetically the best place based upon the type of chart it is and it current state.
newPlacement
- legend placement specification
java.lang.IllegalArgumentException
- if an invalid value is passed in.getPlacement()
public int getPlacement()
setPlacement(int)
public void setFrameLineStyle(LineStyle newFrameLineStyle) throws java.lang.IllegalArgumentException
This method is not applicable in conjunction with a continuous legend such as a legend showing a continuous color ramp which has no frame.
newFrameLineStyle
- the display attributes of the frame's line.
java.lang.IllegalArgumentException
- if newFrameLineStyle is null.getFrameLineStyle()
public LineStyle getFrameLineStyle()
setFrameLineStyle(com.sas.graphics.components.LineStyle)
public void setDrillIconVisible(boolean newVis)
newVis
- Should the drill-down icon be displayed?isDrillIconVisible()
public boolean isDrillIconVisible()
setDrillIconVisible(boolean)
public void setMinimum(double minValue)
java.lang.IllegalArgumentException
- if minValue is
Double.NEGATIVE_INFINITY or Double.POSITIVE_INFINITY.getMinimum()
,
setMaximum(double)
public double getMinimum()
setMinimum(double)
,
getMaximum()
public void setMaximum(double maxValue)
java.lang.IllegalArgumentException
- if maxValue is
Double.NEGATIVE_INFINITY or Double.POSITIVE_INFINITY.getMaximum()
,
setMinimum(double)
public double getMaximum()
setMaximum(double)
,
getMinimum()
public void setBaseline(double baselineValue)
symmetricEnabled
property is only applicable if a baseline
value is specified (i.e. not Double.NaN).
minimum
is specified and baseline
is less than minimum
maximum
is specified and baseline
is greater than maximum
maximum
is specified less than minimum
baseline
value may affect the graph's resulting min/max range.
java.lang.IllegalArgumentException
- if baselineValue is Double.NEGATIVE_INFINITY or Double.POSITIVE_INFINITY.getBaseline()
,
setSymmetricEnabled(boolean)
public double getBaseline()
setMaximum(double)
,
getMinimum()
public void setSymmetricEnabled(boolean symmetry)
The default value is false.
Note: symetricEnabled
is only applicable if baseline
is specified (i.e. not Double.NaN).
Note: symetricEnabled
is not applicable if either minimum
or maximum
are specified.
symmetry
- true means to make the resulting min/max range symmetric about the baselineisSymmetricEnabled()
public boolean isSymmetricEnabled()
setSymmetricEnabled(boolean)
public boolean equals(java.lang.Object obj)
LegendModel
.
The result is true
if and only if the argument is not
null
and is a LegendModel
object that has the same
property values as this object.
equals
in class ContentsModel
obj
- the object to test for equality with this
LegendModel
true
if the objects are the same;
false
otherwise.public int hashCode()
LegendModel
.
hashCode
in class ContentsModel
|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |