Class Legend
java.lang.Object
org.primefaces.model.charts.optionconfig.legend.Legend
- All Implemented Interfaces:
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 -
Method Summary
Modifier and TypeMethodDescriptionencode()
Write the common options of the legend.getAlign()
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
isRtl()
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
setLabels
(LegendLabel labels) 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.
-
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
Position of the legend. top, left, bottom, right.- Returns:
- the position
-
setPosition
Position of the legend. top, left, bottom, right.- Parameters:
position
- the position to set
-
getAlign
Alignment of the legend. Options are:'start','center','end'. Defaults to 'center' for unrecognized values.- Returns:
- the align
-
setAlign
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
Text Direction 'ltr' or 'rtl' regardless of the css specified on the canvas.- Returns:
- the textDirection
-
setTextDirection
Text Direction 'ltr' or 'rtl' regardless of the css specified on the canvas.- Parameters:
textDirection
- the textDirection to set
-
getLabels
The legend label configuration is nested below the legend configuration using the labels key.- Returns:
- the labels
-
setLabels
The legend label configuration is nested below the legend configuration using the labels key.- Parameters:
labels
- the labels to set
-
encode
Write the common options of the legend.- Returns:
- options as JSON object
- Throws:
IOException
- If an I/O error occurs
-