Class LegendItem

  • Direct Known Subclasses:
    LegendLabelItem

    public class LegendItem
    extends AbstractNode
    This is a wrapper of the CHART.JS item which contains the legend item.
    Author:
    Andrea "Stock" Stocchero
    • Constructor Detail

      • LegendItem

        public LegendItem​(ChartEnvelop<LegendItem> envelop)
        Creates the item using another legend item (passed by envelop) which contains all properties.
        Parameters:
        envelop - envelop which contains legend item which contains all properties.
    • Method Detail

      • isHidden

        public final boolean isHidden​(IsChart chart)
        Returns true if this item represents a hidden data set.
        Label will be rendered with a strike-through effect
        Parameters:
        chart - chart instance to check if data set or data are visible
        Returns:
        true if this item represents a hidden data set.
        Label will be rendered with a strike-through effect.
      • getBorderRadius

        public final BorderRadiusItem getBorderRadius()
        Returns the border radius of item.
        Returns:
        the border radius of item.
      • getDatasetIndex

        public final int getDatasetIndex()
        Returns the data set index of the chart
        Returns:
        the data set index of the chart.
      • getIndex

        public final int getIndex()
        Returns the data set index of the chart (for POLAR and PIE charts)
        Returns:
        the data set index of the chart (for POLAR and PIE charts).
      • getText

        public final String getText()
        Returns the label that will be displayed
        Returns:
        the label that will be displayed.
      • isFillStyleAsColor

        public final boolean isFillStyleAsColor()
        Returns true if the fill style is defined as color.
        Returns:
        true if the fill style is defined as color
      • isFillStyleAsGradient

        public final boolean isFillStyleAsGradient()
        Returns true if the fill style is defined as gradient.
        Returns:
        true if the fill style is defined as gradient
      • isFillStyleAsPattern

        public final boolean isFillStyleAsPattern()
        Returns true if the fill style is defined as canvas pattern.
        Returns:
        true if the fill style is defined as canvas pattern
      • getFontColor

        public final IsColor getFontColor()
        Returns the font color of the legend or null if not set.
        Returns:
        the font color of the legend or null if not set
      • getFillStyle

        public final IsColor getFillStyle()
        Returns the fill style of the legend box as color.
        Returns:
        the fill style of the legend box or null if is not a color
      • getFillStyleAsGradient

        public final Gradient getFillStyleAsGradient()
        Returns the fill style of the legend box as gradient.
        Returns:
        the fill style of the legend box or null if is not a gradient
      • getFillStyleAsCanvasGradient

        public final CanvasGradientItem getFillStyleAsCanvasGradient()
        Returns the fill style of the legend box as canvas gradient.
        Returns:
        the fill style of the legend box or null if is not a canvas gradient
      • getFillStyleAsPattern

        public final Pattern getFillStyleAsPattern()
        Returns the fill style of the legend box as pattern.
        Returns:
        the fill style of the legend box or null if is not a pattern
      • getFillStyleAsCanvasPattern

        public final CanvasPatternItem getFillStyleAsCanvasPattern()
        Returns the fill style of the legend box as canvas pattern.
        Returns:
        the fill style of the legend box or null if is not a canvas pattern
      • isStrokeStyleAsColor

        public final boolean isStrokeStyleAsColor()
        Returns true if the stroke style is defined as color.
        Returns:
        true if the stroke style is defined as color
      • isStrokeStyleAsGradient

        public final boolean isStrokeStyleAsGradient()
        Returns true if the stroke style is defined as gradient.
        Returns:
        true if the stroke style is defined as gradient
      • isStrokeStyleAsPattern

        public final boolean isStrokeStyleAsPattern()
        Returns true if the stroke style is defined as gradient.
        Returns:
        true if the stroke style is defined as gradient
      • getStrokeStyle

        public final IsColor getStrokeStyle()
        Returns the stroke style of the legend box as color.
        Returns:
        the stroke style of the legend box or null if is not a color
      • getStrokeStyleAsCanvasGradient

        public final CanvasGradientItem getStrokeStyleAsCanvasGradient()
        Returns the stroke style of the legend box as canvas gradient.
        Returns:
        the stroke style of the legend box or null if is not a canvas gradient
      • getStrokeStyleAsGradient

        public final Gradient getStrokeStyleAsGradient()
        Returns the stroke style of the legend box as gradient.
        Returns:
        the stroke style of the legend box or null if is not a gradient
      • getStrokeStyleAsCanvasPattern

        public final CanvasPatternItem getStrokeStyleAsCanvasPattern()
        Returns the stroke style of the legend box as canvas pattern.
        Returns:
        the stroke style of the legend box or null if is not a canvas pattern
      • getStrokeStyleAsPattern

        public final Pattern getStrokeStyleAsPattern()
        Returns the stroke style of the legend box as pattern.
        Returns:
        the stroke style of the legend box or null if is not a pattern
      • getLineCap

        public final CapStyle getLineCap()
        Returns how the end points of every box border are drawn.
        Returns:
        how the end points of every box border are drawn.
      • getLineDash

        public final List<Integer> getLineDash()
        Returns the box border dash pattern used when stroking lines, using an array of values which specify alternating lengths of lines and gaps which describe the pattern.
        Returns:
        the box border dash pattern used when stroking lines, using an array of values which specify alternating lengths of lines and gaps which describe the pattern.
      • getLineDashOffset

        public final double getLineDashOffset()
        Returns the box border dash pattern offset.
        Returns:
        the box border dash pattern offset.
      • getLineJoin

        public final JoinStyle getLineJoin()
        Returns how two connecting segments (of box border) with non-zero lengths in a shape are joined together (degenerate segments with zero lengths, whose specified end points and control points are exactly at the same position, are skipped).
        Returns:
        how two connecting segments (of lines, arcs or curves) with non-zero lengths in a shape are joined together
      • getLineWidth

        public final int getLineWidth()
        Returns the width of line in pixels.
        Returns:
        the width of line in pixels.
      • getRotation

        public final double getRotation()
        Returns the rotation of the point in degrees (only used if usePointStyle is true).
        Returns:
        the rotation of the point in degrees
      • getPointStyleType

        public final PointStyleType getPointStyleType()
        Returns the type of point style.
        Returns:
        the type of point style
      • getPointStyle

        public final PointStyle getPointStyle()
        Returns the style of the legend box (only used if usePointStyle is true)
        Returns:
        the style of the legend box
      • getPointStyleAsImage

        public final Img getPointStyleAsImage()
        Returns the style (as image) of the legend box (only used if usePointStyle is true)
        Returns:
        the style (as image) of the legend box
      • getPointStyleAsCanvas

        public final Canvas getPointStyleAsCanvas()
        Returns the style (as canvas) of the legend box (only used if usePointStyle is true)
        Returns:
        the style (as canvas) of the legend box