Class Legend

java.lang.Object
com.inet.report.chart.Legend
All Implemented Interfaces:
Serializable

public class Legend extends Object implements Serializable
The class responsible for the settings of the charts legend.
Since:
8.0
See Also:
  • Field Details

    • DEFAULT_FONT

      public static final Font DEFAULT_FONT
      Default legend font.
    • DEFAULT_LABEL_COLOR

      public static final int DEFAULT_LABEL_COLOR
      Default legend color.
      See Also:
    • DEFAULT_LEGEND_OUTLINE_COLOR

      public static final int DEFAULT_LEGEND_OUTLINE_COLOR
      Default legend outline color.
      See Also:
    • TOKEN_LEGEND

      public static final String TOKEN_LEGEND
      XML token for legend element.
      See Also:
  • Constructor Details

    • Legend

      public Legend()
      Creates a legend with default properties.
      Since:
      8.0
  • Method Details

    • isDrawOutline

      public boolean isDrawOutline()
      Returns whether or not to draw the outline of legend.
      Returns:
      true the outline is to be drawn.
      Since:
      8.0
    • setDrawOutline

      public void setDrawOutline(boolean drawOutline)
      Sets whether or not to draw the outline of legend.
      Parameters:
      drawOutline - true if outline is to be drawn.
      Since:
      8.0
    • getLegendPlacement

      public LegendPlacement getLegendPlacement()
      Returns the placement of the legend in the chart.
      Returns:
      the legend placement
      Since:
      8.0
      See Also:
    • setLegendPlacement

      public void setLegendPlacement(LegendPlacement legendPlacement)
      Sets a placement of the legend in the chart. To hide the legend, use LegendPlacement.NONE.
      Parameters:
      legendPlacement - the placement object (null not permitted)
      Throws:
      IllegalArgumentException - if the legend placement is null.
      Since:
      8.0
    • getLegendFont

      public Font getLegendFont()
      Returns the font for all labels in this legend.
      Returns:
      the legend font.
      Since:
      8.0
      See Also:
    • setLegendFont

      public void setLegendFont(Font legendFont)
      Sets the font for all labels in this legend.
      Parameters:
      legendFont - the legend font (null not permitted)
      Since:
      8.0
      See Also:
    • getLegendColor

      public int getLegendColor()
      Returns the ABGR value representing the legend color.
      Returns:
      the ABGR value representing the legend color.
      Since:
      8.0
      See Also:
    • setLegendColor

      public void setLegendColor(int legendColor)
      Sets the ABGR value representing the legend color.
      Parameters:
      legendColor - ABGR components of the legend color - may not be RDC.COLOR_NO_COLOR
      Throws:
      IllegalArgumentException - if the color is RDC.COLOR_NO_COLOR.
      Since:
      8.0
      See Also:
    • getBackColor

      public int getBackColor()
      Returns the ABGR value representing the background color.
      Returns:
      the background color
      Since:
      8.0
      See Also:
    • setBackColor

      public void setBackColor(int backgroundColor)
      Sets the ABGR value representing the legend's background color.
      Parameters:
      backgroundColor - a background color
      Since:
      8.0
      See Also:
    • getOutlineColor

      public int getOutlineColor()
      Returns the ABGR value representing the legend's outline's color.
      Returns:
      the legend's outline's color
      Since:
      8.0
      See Also:
    • setOutlineColor

      public void setOutlineColor(int outlineColor)
      Sets the ABGR components of the legend's outline's color.
      Parameters:
      outlineColor - the color of the legend's outline, may not be RDC.COLOR_NO_COLOR
      Throws:
      IllegalArgumentException - if the color is RDC.COLOR_NO_COLOR.
      Since:
      8.0
      See Also:
    • getOutlineStyle

      public int getOutlineStyle()
      Returns the legend's outline's style.
      Returns:
      the style of the legend's outline
      Since:
      8.0
      See Also:
      • setOutlineStyle(int)
      • BorderPropertiesConstants.NO_LINE
      • BorderPropertiesConstants.LINE_STYLE_SINGLE
      • BorderPropertiesConstants.LINE_STYLE_DASHED
      • BorderPropertiesConstants.LINE_STYLE_DOTTED
    • setOutlineStyle

      public void setOutlineStyle(int outlineStyle)
      Sets the style of the legend's outline.
      Parameters:
      outlineStyle - the legend's outline's style
      Throws:
      IllegalArgumentException - if an unsupported line style is passed.
      Since:
      8.0
      See Also:
      • getOutlineStyle()
      • BorderPropertiesConstants.NO_LINE
      • BorderPropertiesConstants.LINE_STYLE_SINGLE
      • BorderPropertiesConstants.LINE_STYLE_DASHED
      • BorderPropertiesConstants.LINE_STYLE_DOTTED
    • getOutlineWidth

      public int getOutlineWidth()
      Returns the width of the legend's outline in twips.
      Returns:
      the width
      Since:
      8.0
      See Also:
    • setOutlineWidth

      public void setOutlineWidth(int outlineWidth)
      Sets the width of the legend's outline in twips.
      Parameters:
      outlineWidth - the width of the legend's outline
      Throws:
      IllegalArgumentException - if the width is less than 1.
      Since:
      8.0
      See Also:
    • saveProperties

      public void saveProperties(PrintWriter out, int depth)
      Writes the properties of this legend to PrintWriter as XML.
      Parameters:
      out - the output stream to write to
      depth - the depth of XML indent to prefix each line with
      Since:
      8.0
    • readProperties

      public void readProperties(Element element)
      Loads the properties of a chart legend from an XML element.
      Parameters:
      element - DOM element
      Since:
      8.0