Package net.sourceforge.chart2d
Class LegendProperties
java.lang.Object
net.sourceforge.chart2d.LegendProperties
A data structure for holding the properties common to all legends.
Pass this to any number of Chart2D objects.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ColorThe default is Color.white.static final booleanThe default is false.static final booleanThe default is true.static final intThe default is 3.static final booleanThe default is true.static final intThe default is 5.static final ColorThe default is Color.gray.static final booleanThe default is true.static final intThe default is 2.static final ColorThe default is Color.black.static final booleanThe default is true.static final DimensionThe default is the Dimension (9, 9).static final booleanThe default is true.static final booleanThe default is true.static final intThe default is 3.static final ColorThe default is Color.black.static final StringThe default is "SansSerif".static final intThe default is 11.static final intThe default is Font.PLAIN.static final String[]The default is String[0]. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a LegendProperties object with the documented default values.LegendProperties(LegendProperties legendProps) Creates a LegendProperties object with property values copied from another object. -
Method Summary
Modifier and TypeMethodDescriptionfinal ColorGets the color of the legend's background.final booleanGets whether the legend will have a painted background or not.final booleanGets whether the gap between the legend's bullets and labels exists in their horizontal placement.final intGets the thickness of the gap between the legend's bullets and labels in their horizontal placement, for the chart's model size.final booleanGets whether a gap between the legend's bullets or labels exists in their vertical placement.final intGets the thickness of the gap between the legend's bullets or labels exists in their vertical placement, for the chart's model size.final ColorGets the color of the border around the legend.final booleanGets whether there will exist a border around the legend.final intGets the thickness of the border around the legend for the chart's model size.final ColorGets the color of the legend's bullets outline.final booleanGets whether a thin line is painted around the legend's bullets.final DimensionGets the size of the legend's bullets for the chart's model size.final booleanGets whether there will exist a legend on the chart.final booleanGets whether a gap between the legend's border or edge and the legend's inner components exists.final intGets the thickness of the legend's gap for the chart's model size.final ColorGets the color of the font of the legend's labels.final StringGets name of the font of the legend's labels.final intGets the point of the font of the legend's labels for the chart's model size.final intGets the style of the font of the legend's labels.final String[]Gets the texts of the legend labels.final booleanisFontNameExists(String name) Returns true if the font name exists in the graphics enviornment.final voidsetLegendBackgroundColor(Color color) Sets the color of the legend's background.final voidsetLegendBackgroundExistence(boolean existence) Sets whether the legend will have a painted background or not.final voidsetLegendBetweenLabelsAndBulletsGapExistence(boolean existence) Sets whether the gap between the legend's bullets and labels exists in their horizontal placement.final voidsetLegendBetweenLabelsAndBulletsGapThicknessModel(int thickness) Sets the thickness of the gap between the legend's bullets and labels in their horizontal placement, for the chart's model size.final voidsetLegendBetweenLabelsOrBulletsGapExistence(boolean existence) Sets whether a gap between the legend's bullets or labels exists in their vertical placement.final voidsetLegendBetweenLabelsOrBulletsGapThicknessModel(int thickness) Sets the thickness of the gap between the legend's bullets or labels exists in their vertical placement, for the chart's model size.final voidsetLegendBorderColor(Color color) Sets the color of the border around the legend.final voidsetLegendBorderExistence(boolean existence) Sets whether there will exist a border around the legend.final voidsetLegendBorderThicknessModel(int thickness) Sets the thickness of the border around the legend for the chart's model size.final voidSets the color of the legend's bullets outline.final voidsetLegendBulletsOutlineExistence(boolean existence) Sets whether a thin line is painted around the legend's bullets.final voidSets the size of the legend's bullets for the chart's model size.final voidsetLegendExistence(boolean existence) Sets whether there will exist a legend on the chart.final voidsetLegendGapExistence(boolean existence) Sets whether a gap between the legend's border or edge and the legend's inner components exists.final voidsetLegendGapThicknessModel(int thickness) Sets the thickness of the legend's gap for the chart's model size.final voidsetLegendLabelsFontColor(Color color) Sets the color of the font of the legend's labels.final voidSets name of the font of the legend's labels.final voidsetLegendLabelsFontPointModel(int point) Sets the point of the font of the legend's labels for the chart's model size.final voidsetLegendLabelsFontStyle(int style) Sets the style of the font of the legend's labels.final voidsetLegendLabelsTexts(String[] texts) Sets the texts of the legend labels.final voidsetLegendProperties(LegendProperties legendProps) Sets all properties to be the values of another LegendProperties object.final voidSets all properties to their default values.
-
Field Details
-
LEGEND_EXISTENCE_DEFAULT
public static final boolean LEGEND_EXISTENCE_DEFAULTThe default is true.- See Also:
-
LEGEND_LABELS_TEXTS_DEFAULT
The default is String[0]. -
LEGEND_BORDER_EXISTENCE_DEFAULT
public static final boolean LEGEND_BORDER_EXISTENCE_DEFAULTThe default is true.- See Also:
-
LEGEND_BORDER_THICKNESS_MODEL_DEFAULT
public static final int LEGEND_BORDER_THICKNESS_MODEL_DEFAULTThe default is 2.- See Also:
-
LEGEND_BORDER_COLOR_DEFAULT
The default is Color.gray. -
LEGEND_GAP_EXISTENCE_DEFAULT
public static final boolean LEGEND_GAP_EXISTENCE_DEFAULTThe default is true.- See Also:
-
LEGEND_GAP_THICKNESS_MODEL_DEFAULT
public static final int LEGEND_GAP_THICKNESS_MODEL_DEFAULTThe default is 3.- See Also:
-
LEGEND_BACKGROUND_EXISTENCE_DEFAULT
public static final boolean LEGEND_BACKGROUND_EXISTENCE_DEFAULTThe default is false.- See Also:
-
LEGEND_BACKGROUND_COLOR_DEFAULT
The default is Color.white. -
LEGEND_LABELS_FONT_POINT_MODEL_DEFAULT
public static final int LEGEND_LABELS_FONT_POINT_MODEL_DEFAULTThe default is 11.- See Also:
-
LEGEND_LABELS_FONT_NAME_DEFAULT
The default is "SansSerif".- See Also:
-
LEGEND_LABELS_FONT_COLOR_DEFAULT
The default is Color.black. -
LEGEND_LABELS_FONT_STYLE_DEFAULT
public static final int LEGEND_LABELS_FONT_STYLE_DEFAULTThe default is Font.PLAIN.- See Also:
-
LEGEND_BETWEEN_LABELS_OR_BULLETS_GAP_EXISTENCE_DEFAULT
public static final boolean LEGEND_BETWEEN_LABELS_OR_BULLETS_GAP_EXISTENCE_DEFAULTThe default is true.- See Also:
-
LEGEND_BETWEEN_LABELS_OR_BULLETS_GAP_THICKNESS_MODEL_DEFAULT
public static final int LEGEND_BETWEEN_LABELS_OR_BULLETS_GAP_THICKNESS_MODEL_DEFAULTThe default is 5.- See Also:
-
LEGEND_BETWEEN_LABELS_AND_BULLETS_GAP_EXISTENCE_DEFAULT
public static final boolean LEGEND_BETWEEN_LABELS_AND_BULLETS_GAP_EXISTENCE_DEFAULTThe default is true.- See Also:
-
LEGEND_BETWEEN_LABELS_AND_BULLETS_GAP_THICKNESS_MODEL_DEFAULT
public static final int LEGEND_BETWEEN_LABELS_AND_BULLETS_GAP_THICKNESS_MODEL_DEFAULTThe default is 3.- See Also:
-
LEGEND_BULLETS_OUTLINE_EXISTENCE_DEFAULT
public static final boolean LEGEND_BULLETS_OUTLINE_EXISTENCE_DEFAULTThe default is true.- See Also:
-
LEGEND_BULLETS_OUTLINE_COLOR_DEFAULT
The default is Color.black. -
LEGEND_BULLETS_SIZE_MODEL_DEFAULT
The default is the Dimension (9, 9).
-
-
Constructor Details
-
LegendProperties
public LegendProperties()Creates a LegendProperties object with the documented default values. -
LegendProperties
Creates a LegendProperties object with property values copied from another object. The copying is a deep copy.- Parameters:
legendProps- The properties to copy.
-
-
Method Details
-
setLegendPropertiesToDefaults
public final void setLegendPropertiesToDefaults()Sets all properties to their default values. -
setLegendProperties
Sets all properties to be the values of another LegendProperties object. The copying is a deep copy.- Parameters:
legendProps- The properties to copy.
-
setLegendExistence
public final void setLegendExistence(boolean existence) Sets whether there will exist a legend on the chart. If this is true, then the legend labels texts must contain at least one label and every label must be non-null and non-blank in order for validate(...) to succeed.- Parameters:
existence- If true, there will be a legend for the chart.
-
setLegendLabelsTexts
Sets the texts of the legend labels. The number of texts must be equal to the total number of data sets of this chart. If the legend is enabled, then every text must be non-null and non-blank for validate(...) to succeed.- Parameters:
texts- The texts for the legend labels.
-
setLegendBorderExistence
public final void setLegendBorderExistence(boolean existence) Sets whether there will exist a border around the legend.- Parameters:
existence- If true, there will be a border around the legend.
-
setLegendBorderThicknessModel
public final void setLegendBorderThicknessModel(int thickness) Sets the thickness of the border around the legend for the chart's model size.- Parameters:
thickness- The model thicknes for the chart.
-
setLegendBorderColor
Sets the color of the border around the legend.- Parameters:
color- The color of the legend's border.
-
setLegendGapExistence
public final void setLegendGapExistence(boolean existence) Sets whether a gap between the legend's border or edge and the legend's inner components exists.- Parameters:
existence- If true, then a gap exists.
-
setLegendGapThicknessModel
public final void setLegendGapThicknessModel(int thickness) Sets the thickness of the legend's gap for the chart's model size.- Parameters:
thickness- The model thickness of the legend's gap.
-
setLegendBackgroundExistence
public final void setLegendBackgroundExistence(boolean existence) Sets whether the legend will have a painted background or not. If not whatever is behind the legend will show through the spaces of the legend.- Parameters:
existence- If true, the background of the legend will be painted.
-
setLegendBackgroundColor
Sets the color of the legend's background.- Parameters:
color- The color of the legend's background.
-
setLegendLabelsFontPointModel
public final void setLegendLabelsFontPointModel(int point) Sets the point of the font of the legend's labels for the chart's model size.- Parameters:
point- The model font point of the legend's labels.
-
setLegendLabelsFontName
Sets name of the font of the legend's labels. Accepts all values accepted by java.awt.Font.- Parameters:
name- The name of the font for the legend's labels.
-
setLegendLabelsFontColor
Sets the color of the font of the legend's labels.- Parameters:
color- The color of the font of the legend's labels.
-
setLegendLabelsFontStyle
public final void setLegendLabelsFontStyle(int style) Sets the style of the font of the legend's labels. Accepts all values that java.awt.Font accepts.- Parameters:
style- The style of the font of the legend's labels.
-
setLegendBetweenLabelsOrBulletsGapExistence
public final void setLegendBetweenLabelsOrBulletsGapExistence(boolean existence) Sets whether a gap between the legend's bullets or labels exists in their vertical placement.- Parameters:
existence- If true, a gap exists.
-
setLegendBetweenLabelsOrBulletsGapThicknessModel
public final void setLegendBetweenLabelsOrBulletsGapThicknessModel(int thickness) Sets the thickness of the gap between the legend's bullets or labels exists in their vertical placement, for the chart's model size.- Parameters:
thickness- The model thickness of the gap.
-
setLegendBetweenLabelsAndBulletsGapExistence
public final void setLegendBetweenLabelsAndBulletsGapExistence(boolean existence) Sets whether the gap between the legend's bullets and labels exists in their horizontal placement.- Parameters:
existence- If true, a gap exists.
-
setLegendBetweenLabelsAndBulletsGapThicknessModel
public final void setLegendBetweenLabelsAndBulletsGapThicknessModel(int thickness) Sets the thickness of the gap between the legend's bullets and labels in their horizontal placement, for the chart's model size.- Parameters:
thickness- The model thickness of teh gap.
-
setLegendBulletsOutlineExistence
public final void setLegendBulletsOutlineExistence(boolean existence) Sets whether a thin line is painted around the legend's bullets.- Parameters:
existence- If true, the legend's bullets will be outlined.
-
setLegendBulletsOutlineColor
Sets the color of the legend's bullets outline.- Parameters:
color- The color of the legend's bullets outline.
-
setLegendBulletsSizeModel
Sets the size of the legend's bullets for the chart's model size.- Parameters:
size- The size of the legend's bullets.
-
getLegendExistence
public final boolean getLegendExistence()Gets whether there will exist a legend on the chart.- Returns:
- boolean If true, there will be a legend for the chart.
-
getLegendLabelsTexts
Gets the texts of the legend labels. The number of texts must be equal to the total number of data sets of this chart. If the legend is enabled, then every text must be non-null and non-blank for validate(...) to succeed.- Returns:
- String[] The texts for the legend labels.
-
getLegendBorderExistence
public final boolean getLegendBorderExistence()Gets whether there will exist a border around the legend.- Returns:
- boolean If true, there will be a border around the legend.
-
getLegendBorderThicknessModel
public final int getLegendBorderThicknessModel()Gets the thickness of the border around the legend for the chart's model size.- Returns:
- int The model thicknes for the chart.
-
getLegendBorderColor
Gets the color of the border around the legend.- Returns:
- Color The color of the legend's border.
-
getLegendGapExistence
public final boolean getLegendGapExistence()Gets whether a gap between the legend's border or edge and the legend's inner components exists.- Returns:
- boolean If true, then a gap exists.
-
getLegendGapThicknessModel
public final int getLegendGapThicknessModel()Gets the thickness of the legend's gap for the chart's model size.- Returns:
- int The model thickness of the legend's gap.
-
getLegendBackgroundExistence
public final boolean getLegendBackgroundExistence()Gets whether the legend will have a painted background or not. If not whatever is behind the legend will show through the spaces of the legend.- Returns:
- boolean If true, the background of the legend will be painted.
-
getLegendBackgroundColor
Gets the color of the legend's background.- Returns:
- Color The color of the legend's background.
-
getLegendLabelsFontPointModel
public final int getLegendLabelsFontPointModel()Gets the point of the font of the legend's labels for the chart's model size.- Returns:
- int The model font point of the legend's labels.
-
getLegendLabelsFontName
Gets name of the font of the legend's labels. Accepts all values accepted by java.awt.Font.- Returns:
- String The name of the font for the legend's labels.
-
getLegendLabelsFontColor
Gets the color of the font of the legend's labels.- Returns:
- Color The color of the font of the legend's labels.
-
getLegendLabelsFontStyle
public final int getLegendLabelsFontStyle()Gets the style of the font of the legend's labels. Accepts all values that java.awt.Font accepts.- Returns:
- int The style of the font of the legend's labels.
-
getLegendBetweenLabelsOrBulletsGapExistence
public final boolean getLegendBetweenLabelsOrBulletsGapExistence()Gets whether a gap between the legend's bullets or labels exists in their vertical placement.- Returns:
- boolean If true, a gap exists.
-
getLegendBetweenLabelsOrBulletsGapThicknessModel
public final int getLegendBetweenLabelsOrBulletsGapThicknessModel()Gets the thickness of the gap between the legend's bullets or labels exists in their vertical placement, for the chart's model size.- Returns:
- int The model thickness of the gap.
-
getLegendBetweenLabelsAndBulletsGapExistence
public final boolean getLegendBetweenLabelsAndBulletsGapExistence()Gets whether the gap between the legend's bullets and labels exists in their horizontal placement.- Returns:
- boolean If true, a gap exists.
-
getLegendBetweenLabelsAndBulletsGapThicknessModel
public final int getLegendBetweenLabelsAndBulletsGapThicknessModel()Gets the thickness of the gap between the legend's bullets and labels in their horizontal placement, for the chart's model size.- Returns:
- int The model thickness of teh gap.
-
getLegendBulletsOutlineExistence
public final boolean getLegendBulletsOutlineExistence()Gets whether a thin line is painted around the legend's bullets.- Returns:
- boolean If true, the legend's bullets will be outlined.
-
getLegendBulletsOutlineColor
Gets the color of the legend's bullets outline.- Returns:
- Color The color of the legend's bullets outline.
-
getLegendBulletsSizeModel
Gets the size of the legend's bullets for the chart's model size.- Returns:
- Dimension The size of the legend's bullets.
-
isFontNameExists
Returns true if the font name exists in the graphics enviornment.- Parameters:
name- The name of the font to determine the existence of.- Returns:
- boolean If true, then the font name exists.
-