Package org.pepstock.charba.client.items
Class LegendItem
- java.lang.Object
-
- org.pepstock.charba.client.commons.NativeObjectContainer
-
- org.pepstock.charba.client.commons.AbstractNode
-
- org.pepstock.charba.client.items.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
LegendItem.LegendItemFactory
Inner class to create legend item by a native object.
-
Field Summary
Fields Modifier and Type Field Description static LegendItem.LegendItemFactory
FACTORY
Public factory to create a legend item from a native object.
-
Constructor Summary
Constructors Constructor Description LegendItem(ChartEnvelop<LegendItem> envelop)
Creates the item using another legend item (passed by envelop) which contains all properties.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BorderRadiusItem
getBorderRadius()
Returns the border radius of item.int
getDatasetIndex()
Returns the data set index of the chartIsColor
getFillStyle()
Returns the fill style of the legend box as color.CanvasGradientItem
getFillStyleAsCanvasGradient()
Returns the fill style of the legend box as canvas gradient.CanvasPatternItem
getFillStyleAsCanvasPattern()
Returns the fill style of the legend box as canvas pattern.Gradient
getFillStyleAsGradient()
Returns the fill style of the legend box as gradient.Pattern
getFillStyleAsPattern()
Returns the fill style of the legend box as pattern.IsColor
getFontColor()
Returns the font color of the legend ornull
if not set.int
getIndex()
Returns the data set index of the chart (for POLAR and PIE charts)CapStyle
getLineCap()
Returns how the end points of every box border are drawn.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.double
getLineDashOffset()
Returns the box border dash pattern offset.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).int
getLineWidth()
Returns the width of line in pixels.PointStyle
getPointStyle()
Returns the style of the legend box (only used if usePointStyle is true)Canvas
getPointStyleAsCanvas()
Returns the style (as canvas) of the legend box (only used if usePointStyle is true)Img
getPointStyleAsImage()
Returns the style (as image) of the legend box (only used if usePointStyle is true)PointStyleType
getPointStyleType()
Returns the type of point style.double
getRotation()
Returns the rotation of the point in degrees (only used if usePointStyle is true).IsColor
getStrokeStyle()
Returns the stroke style of the legend box as color.CanvasGradientItem
getStrokeStyleAsCanvasGradient()
Returns the stroke style of the legend box as canvas gradient.CanvasPatternItem
getStrokeStyleAsCanvasPattern()
Returns the stroke style of the legend box as canvas pattern.Gradient
getStrokeStyleAsGradient()
Returns the stroke style of the legend box as gradient.Pattern
getStrokeStyleAsPattern()
Returns the stroke style of the legend box as pattern.String
getText()
Returns the label that will be displayedboolean
isFillStyleAsColor()
Returnstrue
if the fill style is defined as color.boolean
isFillStyleAsGradient()
Returnstrue
if the fill style is defined as gradient.boolean
isFillStyleAsPattern()
Returnstrue
if the fill style is defined as canvas pattern.boolean
isHidden(IsChart chart)
Returnstrue
if this item represents a hidden data set.
Label will be rendered with a strike-through effectboolean
isStrokeStyleAsColor()
Returnstrue
if the stroke style is defined as color.boolean
isStrokeStyleAsGradient()
Returnstrue
if the stroke style is defined as gradient.boolean
isStrokeStyleAsPattern()
Returnstrue
if the stroke style is defined as gradient.-
Methods inherited from class org.pepstock.charba.client.commons.AbstractNode
checkAndAddToParent, getChildKey, getParentNode, getRootNode, getUpdateListener, retrieveRoot, setArrayValueAndAddToParent, setArrayValueAndAddToParent, setArrayValueAndAddToParent, setElementAndAddToParent, setInternalCallbackToModel, setInternalCallbackToModel, setUpdateListener, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent
-
Methods inherited from class org.pepstock.charba.client.commons.NativeObjectContainer
checkDefaultValuesArgument, empty, getArrayValue, getElement, getIncrementalId, getNativeChart, getNativeEvent, getNativeObject, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValueForMultipleKeyTypes, getValueForMultipleKeyTypes, getValueForMultipleKeyTypes, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, has, has, isType, keys, loadNativeObject, remove, remove, setArrayValue, setArrayValue, setArrayValue, setElement, setEmptyValue, setNewIncrementalId, setNewIncrementalId, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, toJSON, type
-
-
-
-
Field Detail
-
FACTORY
public static final LegendItem.LegendItemFactory FACTORY
Public factory to create a legend item from a native object.
-
-
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)
Returnstrue
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()
Returnstrue
if the fill style is defined as color.- Returns:
true
if the fill style is defined as color
-
isFillStyleAsGradient
public final boolean isFillStyleAsGradient()
Returnstrue
if the fill style is defined as gradient.- Returns:
true
if the fill style is defined as gradient
-
isFillStyleAsPattern
public final boolean isFillStyleAsPattern()
Returnstrue
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 ornull
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()
Returnstrue
if the stroke style is defined as color.- Returns:
true
if the stroke style is defined as color
-
isStrokeStyleAsGradient
public final boolean isStrokeStyleAsGradient()
Returnstrue
if the stroke style is defined as gradient.- Returns:
true
if the stroke style is defined as gradient
-
isStrokeStyleAsPattern
public final boolean isStrokeStyleAsPattern()
Returnstrue
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
-
-