Class LegendProperties

java.lang.Object
net.sourceforge.chart2d.LegendProperties

public final class LegendProperties extends Object
A data structure for holding the properties common to all legends. Pass this to any number of Chart2D objects.
  • Field Details

    • LEGEND_EXISTENCE_DEFAULT

      public static final boolean LEGEND_EXISTENCE_DEFAULT
      The default is true.
      See Also:
    • LEGEND_LABELS_TEXTS_DEFAULT

      public static final String[] LEGEND_LABELS_TEXTS_DEFAULT
      The default is String[0].
    • LEGEND_BORDER_EXISTENCE_DEFAULT

      public static final boolean LEGEND_BORDER_EXISTENCE_DEFAULT
      The default is true.
      See Also:
    • LEGEND_BORDER_THICKNESS_MODEL_DEFAULT

      public static final int LEGEND_BORDER_THICKNESS_MODEL_DEFAULT
      The default is 2.
      See Also:
    • LEGEND_BORDER_COLOR_DEFAULT

      public static final Color LEGEND_BORDER_COLOR_DEFAULT
      The default is Color.gray.
    • LEGEND_GAP_EXISTENCE_DEFAULT

      public static final boolean LEGEND_GAP_EXISTENCE_DEFAULT
      The default is true.
      See Also:
    • LEGEND_GAP_THICKNESS_MODEL_DEFAULT

      public static final int LEGEND_GAP_THICKNESS_MODEL_DEFAULT
      The default is 3.
      See Also:
    • LEGEND_BACKGROUND_EXISTENCE_DEFAULT

      public static final boolean LEGEND_BACKGROUND_EXISTENCE_DEFAULT
      The default is false.
      See Also:
    • LEGEND_BACKGROUND_COLOR_DEFAULT

      public static final Color LEGEND_BACKGROUND_COLOR_DEFAULT
      The default is Color.white.
    • LEGEND_LABELS_FONT_POINT_MODEL_DEFAULT

      public static final int LEGEND_LABELS_FONT_POINT_MODEL_DEFAULT
      The default is 11.
      See Also:
    • LEGEND_LABELS_FONT_NAME_DEFAULT

      public static final String LEGEND_LABELS_FONT_NAME_DEFAULT
      The default is "SansSerif".
      See Also:
    • LEGEND_LABELS_FONT_COLOR_DEFAULT

      public static final Color LEGEND_LABELS_FONT_COLOR_DEFAULT
      The default is Color.black.
    • LEGEND_LABELS_FONT_STYLE_DEFAULT

      public static final int LEGEND_LABELS_FONT_STYLE_DEFAULT
      The 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_DEFAULT
      The 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_DEFAULT
      The default is 5.
      See Also:
    • LEGEND_BETWEEN_LABELS_AND_BULLETS_GAP_EXISTENCE_DEFAULT

      public static final boolean LEGEND_BETWEEN_LABELS_AND_BULLETS_GAP_EXISTENCE_DEFAULT
      The 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_DEFAULT
      The default is 3.
      See Also:
    • LEGEND_BULLETS_OUTLINE_EXISTENCE_DEFAULT

      public static final boolean LEGEND_BULLETS_OUTLINE_EXISTENCE_DEFAULT
      The default is true.
      See Also:
    • LEGEND_BULLETS_OUTLINE_COLOR_DEFAULT

      public static final Color LEGEND_BULLETS_OUTLINE_COLOR_DEFAULT
      The default is Color.black.
    • LEGEND_BULLETS_SIZE_MODEL_DEFAULT

      public static final Dimension 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

      public LegendProperties(LegendProperties legendProps)
      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

      public final void setLegendProperties(LegendProperties legendProps)
      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

      public final void setLegendLabelsTexts(String[] texts)
      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

      public final void setLegendBorderColor(Color color)
      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

      public final void setLegendBackgroundColor(Color color)
      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

      public final void setLegendLabelsFontName(String name)
      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

      public final void setLegendLabelsFontColor(Color color)
      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

      public final void setLegendBulletsOutlineColor(Color color)
      Sets the color of the legend's bullets outline.
      Parameters:
      color - The color of the legend's bullets outline.
    • setLegendBulletsSizeModel

      public final void setLegendBulletsSizeModel(Dimension size)
      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

      public final String[] 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

      public final Color 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

      public final Color 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

      public final String 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

      public final Color 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

      public final Color getLegendBulletsOutlineColor()
      Gets the color of the legend's bullets outline.
      Returns:
      Color The color of the legend's bullets outline.
    • getLegendBulletsSizeModel

      public final Dimension 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

      public final boolean isFontNameExists(String name)
      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.