java.lang.Object
org.primefaces.model.charts.optionconfig.legend.Legend
All Implemented Interfaces:
Serializable

public class Legend extends Object implements Serializable
The chart legend displays data about the datasets that are appearing on the chart. The legend configuration is passed into the options.legend namespace. The global options for the chart legend is defined in Chart.defaults.global.legend.
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Write the common options of the legend.
    Alignment of the legend.
    The legend label configuration is nested below the legend configuration using the labels key.
    Position of the legend.
    Text Direction 'ltr' or 'rtl' regardless of the css specified on the canvas.
    boolean
    Is the legend shown?
    boolean
    Marks that this box should take the full width of the canvas (pushing down other boxes).
    boolean
    Legend will show datasets in reverse order.
    boolean
    For rendering the legends from right to left.
    void
    Alignment of the legend.
    void
    setDisplay(boolean display)
    Set if the legend is shown.
    void
    setFullWidth(boolean fullWidth)
    Marks that this box should take the full width of the canvas (pushing down other boxes).
    void
    The legend label configuration is nested below the legend configuration using the labels key.
    void
    setPosition(String position)
    Position of the legend.
    void
    setReverse(boolean reverse)
    Legend will show datasets in reverse order.
    void
    setRtl(boolean rtl)
    For rendering the legends from right to left.
    void
    setTextDirection(String textDirection)
    Text Direction 'ltr' or 'rtl' regardless of the css specified on the canvas.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Legend

      public Legend()
  • Method Details

    • isDisplay

      public boolean isDisplay()
      Is the legend shown?
      Returns:
      the display
    • setDisplay

      public void setDisplay(boolean display)
      Set if the legend is shown.
      Parameters:
      display - the display to set
    • getPosition

      public String getPosition()
      Position of the legend. top, left, bottom, right.
      Returns:
      the position
    • setPosition

      public void setPosition(String position)
      Position of the legend. top, left, bottom, right.
      Parameters:
      position - the position to set
    • getAlign

      public String getAlign()
      Alignment of the legend. Options are:'start','center','end'. Defaults to 'center' for unrecognized values.
      Returns:
      the align
    • setAlign

      public void setAlign(String align)
      Alignment of the legend. Options are:'start','center','end'. Defaults to 'center' for unrecognized values.
      Parameters:
      align - the align to set
    • isFullWidth

      public boolean isFullWidth()
      Marks that this box should take the full width of the canvas (pushing down other boxes). This is unlikely to need to be changed in day-to-day use.
      Returns:
      the fullWidth
    • setFullWidth

      public void setFullWidth(boolean fullWidth)
      Marks that this box should take the full width of the canvas (pushing down other boxes). This is unlikely to need to be changed in day-to-day use.
      Parameters:
      fullWidth - the fullWidth to set
    • isReverse

      public boolean isReverse()
      Legend will show datasets in reverse order.
      Returns:
      the reverse
    • setReverse

      public void setReverse(boolean reverse)
      Legend will show datasets in reverse order.
      Parameters:
      reverse - the reverse to set
    • isRtl

      public boolean isRtl()
      For rendering the legends from right to left.
      Returns:
      the rtl
    • setRtl

      public void setRtl(boolean rtl)
      For rendering the legends from right to left.
      Parameters:
      rtl - the rtl to set
    • getTextDirection

      public String getTextDirection()
      Text Direction 'ltr' or 'rtl' regardless of the css specified on the canvas.
      Returns:
      the textDirection
    • setTextDirection

      public void setTextDirection(String textDirection)
      Text Direction 'ltr' or 'rtl' regardless of the css specified on the canvas.
      Parameters:
      textDirection - the textDirection to set
    • getLabels

      public LegendLabel getLabels()
      The legend label configuration is nested below the legend configuration using the labels key.
      Returns:
      the labels
    • setLabels

      public void setLabels(LegendLabel labels)
      The legend label configuration is nested below the legend configuration using the labels key.
      Parameters:
      labels - the labels to set
    • encode

      public String encode() throws IOException
      Write the common options of the legend.
      Returns:
      options as JSON object
      Throws:
      IOException - If an I/O error occurs