Class LegendLabels
- java.lang.Object
-
- org.pepstock.charba.client.configuration.LegendLabels
-
public class LegendLabels extends Object
This is the labels configuration of the legend.- Author:
- Andrea "Stock" Stocchero
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getBorderRadius()
Returns the border radius (in pixels).int
getBoxHeight()
Returns the height of colored box.int
getBoxWidth()
Returns the width of colored box.IsChart
getChart()
Returns the chart instanceIsColor
getColor()
Returns the font color.String
getColorAsString()
Returns the font color as string.protected ExtendedOptions
getConfiguration()
Returns the configuration element.LegendFilterCallback
getFilterCallback()
Returns the user filter callback instance.Font
getFont()
Returns the font element.LegendItemSortCallback
getItemSortCallback()
Returns the user item sort callback instance.LegendLabelsCallback
getLabelsCallback()
Returns the user callback instance to generate labels.protected ConfigurationOptions
getOptions()
Returns the configuration options.int
getPadding()
Returns the padding to apply around labels.PointStyle
getPointStyle()
Returns the style of the legend.Canvas
getPointStyleAsCanvas()
Returns the style of the point as canvas.Img
getPointStyleAsImage()
Returns the style of the legend as image.PointStyleType
getPointStyleType()
Returns the type of point style.double
getPointStyleWidth()
Returns ifusePointStyle
is true, the width of the point style used for the legend.TextAlign
getTextAlign()
Returns the horizontal alignment of the label text.boolean
isUseBorderRadius()
Returns if label border radius will match corresponding borderRadius.boolean
isUsePointStyle()
Returns if label style will match corresponding point style (size is based on fontSize, boxWidth is not used in this case).void
setBorderRadius(int radius)
Sets the border radius.void
setBoxHeight(int boxHeight)
Sets the height of colored box.void
setBoxWidth(int boxWidth)
Sets the width of colored box.void
setColor(String color)
Sets the font color.void
setColor(IsColor color)
Sets the font color.void
setFilterCallback(LegendFilterCallback filterCallback)
Sets the user filter callback instance.void
setItemSortCallback(LegendItemSortCallback itemSortCallback)
Sets the user item sort callback instance.void
setLabelsCallback(LegendLabelsCallback labelsCallback)
Sets the user callback instance to generate labels.void
setPadding(int padding)
Sets the padding to apply around labels.void
setPointStyle(boolean pointStyle)
Sets the style of the legend, overriding point style from dataset.
Only applies ifsetUsePointStyle(boolean)
is set totrue
.void
setPointStyle(Canvas pointStyle)
Sets the style of the legend, overriding point style from dataset, as canvas.
Only applies ifsetUsePointStyle(boolean)
is set totrue
.void
setPointStyle(Img pointStyle)
Sets the style of the legend, overriding point style from dataset, as image.
Only applies ifsetUsePointStyle(boolean)
is set totrue
.void
setPointStyle(PointStyle pointStyle)
Sets the style of the legend, overriding point style from dataset.
Only applies ifsetUsePointStyle(boolean)
is set totrue
.void
setPointStyleWidth(double pointStyleWidth)
Sets ifusePointStyle
is true, the width of the point style used for the legend.void
setTextAlign(TextAlign align)
Sets the horizontal alignment of the label text.void
setUseBorderRadius(boolean useRadius)
Sets if label border radius will match corresponding borderRadius.void
setUsePointStyle(boolean usePointStyle)
Sets if label style will match corresponding point style (size is based on fontSize, boxWidth is not used in this case).
-
-
-
Method Detail
-
getFont
public Font getFont()
Returns the font element.- Returns:
- the font
-
setColor
public void setColor(IsColor color)
Sets the font color.- Parameters:
color
- font color.
-
setColor
public void setColor(String color)
Sets the font color.- Parameters:
color
- font color.
-
getColorAsString
public String getColorAsString()
Returns the font color as string.- Returns:
- font color as string
-
getColor
public IsColor getColor()
Returns the font color.- Returns:
- font color
-
setUsePointStyle
public void setUsePointStyle(boolean usePointStyle)
Sets if label style will match corresponding point style (size is based on fontSize, boxWidth is not used in this case).- Parameters:
usePointStyle
- if label style will match corresponding point style (size is based on fontSize, boxWidth is not used in this case).
-
isUsePointStyle
public boolean isUsePointStyle()
Returns if label style will match corresponding point style (size is based on fontSize, boxWidth is not used in this case).- Returns:
- if label style will match corresponding point style (size is based on fontSize, boxWidth is not used in this case).
-
setPointStyleWidth
public void setPointStyleWidth(double pointStyleWidth)
Sets ifusePointStyle
is true, the width of the point style used for the legend.- Parameters:
pointStyleWidth
- ifusePointStyle
is true, the width of the point style used for the legend.
-
getPointStyleWidth
public double getPointStyleWidth()
Returns ifusePointStyle
is true, the width of the point style used for the legend.- Returns:
- if
usePointStyle
is true, the width of the point style used for the legend.
-
setPointStyle
public void setPointStyle(boolean pointStyle)
Sets the style of the legend, overriding point style from dataset.
Only applies ifsetUsePointStyle(boolean)
is set totrue
.- Parameters:
pointStyle
- the style of the legend, overriding point style from dataset.
-
setPointStyle
public void setPointStyle(PointStyle pointStyle)
Sets the style of the legend, overriding point style from dataset.
Only applies ifsetUsePointStyle(boolean)
is set totrue
.- Parameters:
pointStyle
- the style of the legend, overriding point style from dataset.
-
setPointStyle
public void setPointStyle(Img pointStyle)
Sets the style of the legend, overriding point style from dataset, as image.
Only applies ifsetUsePointStyle(boolean)
is set totrue
.- Parameters:
pointStyle
- the style of the legend, overriding point style from dataset.
-
setPointStyle
public void setPointStyle(Canvas pointStyle)
Sets the style of the legend, overriding point style from dataset, as canvas.
Only applies ifsetUsePointStyle(boolean)
is set totrue
.- Parameters:
pointStyle
- the style of the legend, overriding point style from dataset.
-
getPointStyleType
public PointStyleType getPointStyleType()
Returns the type of point style.- Returns:
- the type of point style
-
getPointStyle
public PointStyle getPointStyle()
Returns the style of the legend.- Returns:
- the style of the legend.
-
getPointStyleAsCanvas
public Canvas getPointStyleAsCanvas()
Returns the style of the point as canvas.- Returns:
- the style of the point as canvas.
-
getPointStyleAsImage
public Img getPointStyleAsImage()
Returns the style of the legend as image.- Returns:
- the style of the legend as image.
-
setBoxWidth
public void setBoxWidth(int boxWidth)
Sets the width of colored box.- Parameters:
boxWidth
- width of colored box.
-
getBoxWidth
public int getBoxWidth()
Returns the width of colored box.- Returns:
- width of colored box.
-
setBoxHeight
public void setBoxHeight(int boxHeight)
Sets the height of colored box.- Parameters:
boxHeight
- height of colored box.
-
getBoxHeight
public int getBoxHeight()
Returns the height of colored box.- Returns:
- height of colored box.
-
setPadding
public void setPadding(int padding)
Sets the padding to apply around labels. Only top and bottom are implemented.- Parameters:
padding
- Padding to apply around labels. Only top and bottom are implemented.
-
getPadding
public int getPadding()
Returns the padding to apply around labels. Only top and bottom are implemented.- Returns:
- Padding to apply around labels. Only top and bottom are implemented.
-
setTextAlign
public void setTextAlign(TextAlign align)
Sets the horizontal alignment of the label text.- Parameters:
align
- the horizontal alignment of the label text.
-
getTextAlign
public TextAlign getTextAlign()
Returns the horizontal alignment of the label text.- Returns:
- the horizontal alignment of the label text.
-
isUseBorderRadius
public boolean isUseBorderRadius()
Returns if label border radius will match corresponding borderRadius.- Returns:
- if label border radius will match corresponding borderRadius.
-
setUseBorderRadius
public void setUseBorderRadius(boolean useRadius)
Sets if label border radius will match corresponding borderRadius.- Parameters:
useRadius
- if label border radius will match corresponding borderRadius.
-
setBorderRadius
public void setBorderRadius(int radius)
Sets the border radius.- Parameters:
radius
- the border radius.
-
getBorderRadius
public int getBorderRadius()
Returns the border radius (in pixels).- Returns:
- the border radius (in pixels).
-
getFilterCallback
public LegendFilterCallback getFilterCallback()
Returns the user filter callback instance.- Returns:
- the user filter callback instance
-
setFilterCallback
public void setFilterCallback(LegendFilterCallback filterCallback)
Sets the user filter callback instance.- Parameters:
filterCallback
- the user filter callback instance
-
getLabelsCallback
public LegendLabelsCallback getLabelsCallback()
Returns the user callback instance to generate labels.- Returns:
- the user callback instance to generate labels
-
setLabelsCallback
public void setLabelsCallback(LegendLabelsCallback labelsCallback)
Sets the user callback instance to generate labels.- Parameters:
labelsCallback
- the user callback instance to generate labels
-
getItemSortCallback
public LegendItemSortCallback getItemSortCallback()
Returns the user item sort callback instance.- Returns:
- the user item sort callback instance
-
setItemSortCallback
public void setItemSortCallback(LegendItemSortCallback itemSortCallback)
Sets the user item sort callback instance.- Parameters:
itemSortCallback
- the user item sort callback instance
-
getOptions
protected final ConfigurationOptions getOptions()
Returns the configuration options.- Returns:
- the configuration options.
-
getConfiguration
protected final ExtendedOptions getConfiguration()
Returns the configuration element.- Returns:
- the configuration element.
-
getChart
public final IsChart getChart()
Returns the chart instance- Returns:
- the chart
-
-