Class Subtitle
- java.lang.Object
-
- org.pepstock.charba.client.configuration.Subtitle
-
- All Implemented Interfaces:
IsScriptableFontProvider<ChartContext>
,IsScriptablePaddingProvider<ChartContext>
public class Subtitle extends Object
Configures the chart title which defines text to draw at the top of the chart.- Author:
- Andrea "Stock" Stocchero
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ElementAlign
getAlign()
Returns the alignment of the title.ElementAlignCallback<ChartContext>
getAlignCallback()
Returns the align callback, if set, otherwisenull
.IsChart
getChart()
Returns the chart instanceIsColor
getColor()
Returns the font color.String
getColorAsString()
Returns the font color as string.ColorCallback<ChartContext>
getColorCallback()
Returns the color callback, if set, otherwisenull
.protected ExtendedOptions
getConfiguration()
Returns the configuration element.DisplayCallback<ChartContext>
getDisplayCallback()
Returns the callback to set if the title is shown.Font
getFont()
Returns the font element.FontCallback<ChartContext>
getFontCallback()
Returns the font callback, if set, otherwisenull
.FullSizeCallback<ChartContext>
getFullSizeCallback()
Returns the callback to set if marks that this box should take the full width/height of the canvas (moving other boxes).protected ConfigurationOptions
getOptions()
Returns the configuration options.Padding
getPadding()
Returns the padding element.PaddingCallback<ChartContext>
getPaddingCallback()
Returns the padding callback, if set, otherwisenull
.Position
getPosition()
Returns the position of title.PositionCallback<ChartContext>
getPositionCallback()
Returns the position callback, if set, otherwisenull
.List<String>
getText()
Returns the title text to display, as a list of strings.TextCallback<ChartContext>
getTextCallback()
Returns the text callback, if set, otherwisenull
.boolean
isDisplay()
Returns if the title is shown.boolean
isFullSize()
Returns if marks that this box should take the full width/height of the canvas (moving other boxes).void
setAlign(ElementAlignCallback<ChartContext> alignCallback)
Sets the align callback.void
setAlign(NativeCallback alignCallback)
Sets the align callback.void
setAlign(ElementAlign alignment)
Sets the alignment of the title.void
setColor(String color)
Sets the font color.void
setColor(ColorCallback<ChartContext> colorCallback)
Sets the color callback.void
setColor(NativeCallback colorCallback)
Sets the color callback.void
setColor(IsColor color)
Sets the font color.void
setDisplay(boolean display)
Sets if the title is shown.void
setDisplay(DisplayCallback<ChartContext> displayCallback)
Sets if the title is shown by a callback.void
setDisplay(NativeCallback displayCallback)
Sets if the title is shown by a callback.void
setFont(FontCallback<ChartContext> fontCallback)
Sets the font callback.void
setFont(NativeCallback fontCallback)
Sets the font callback.void
setFullSize(boolean fullSize)
Marks that this box should take the full width/height of the canvas (moving other boxes).void
setFullSize(FullSizeCallback<ChartContext> fullSizeCallback)
Sets if marks that this box should take the full width/height of the canvas (moving other boxes) is shown by a callback.void
setFullSize(NativeCallback fullSizeCallback)
Sets if marks that this box should take the full width/height of the canvas (moving other boxes) is shown by a callback.void
setPadding(NativeCallback paddingCallback)
Sets the padding callback.void
setPadding(PaddingCallback<ChartContext> paddingCallback)
Sets the padding callback.void
setPosition(NativeCallback positionCallback)
Sets the position callback.void
setPosition(PositionCallback<ChartContext> positionCallback)
Sets the position callback.void
setPosition(Position position)
Sets the position of title.void
setText(String... text)
Sets the title text to display.void
setText(NativeCallback textCallback)
Sets the text callback.void
setText(TextCallback<ChartContext> textCallback)
Sets the text callback.
-
-
-
Method Detail
-
getFont
public Font getFont()
Returns the font element.- Returns:
- the font
-
getPadding
public Padding getPadding()
Returns the padding element.- Returns:
- the padding
-
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
-
setDisplay
public void setDisplay(boolean display)
Sets if the title is shown.- Parameters:
display
- if the title is shown.
-
isDisplay
public boolean isDisplay()
Returns if the title is shown.- Returns:
- if the title is shown.
-
setText
public void setText(String... text)
Sets the title text to display. If specified as an array, text is rendered on multiple lines.- Parameters:
text
- the title text to display. If specified as an array, text is rendered on multiple lines.
-
getText
public List<String> getText()
Returns the title text to display, as a list of strings.- Returns:
- a list of strings
-
setPosition
public void setPosition(Position position)
Sets the position of title.- Parameters:
position
- the position of title.
-
getPosition
public Position getPosition()
Returns the position of title.- Returns:
- the position of title.
-
setFullSize
public void setFullSize(boolean fullSize)
Marks that this box should take the full width/height of the canvas (moving other boxes).- Parameters:
fullSize
- Marks that this box should take the full width/height of the canvas (moving other boxes)
-
isFullSize
public boolean isFullSize()
Returns if marks that this box should take the full width/height of the canvas (moving other boxes).- Returns:
- Marks that this box should take the full width/height of the canvas (moving other boxes)
-
setAlign
public void setAlign(ElementAlign alignment)
Sets the alignment of the title.- Parameters:
alignment
- alignment of the title.
-
getAlign
public ElementAlign getAlign()
Returns the alignment of the title.- Returns:
- alignment of the title.
-
getDisplayCallback
public DisplayCallback<ChartContext> getDisplayCallback()
Returns the callback to set if the title is shown.- Returns:
- the callback instance to use
-
setDisplay
public void setDisplay(DisplayCallback<ChartContext> displayCallback)
Sets if the title is shown by a callback.- Parameters:
displayCallback
- the callback instance to use
-
setDisplay
public void setDisplay(NativeCallback displayCallback)
Sets if the title is shown by a callback.- Parameters:
displayCallback
- the callback instance to use
-
getFullSizeCallback
public FullSizeCallback<ChartContext> getFullSizeCallback()
Returns the callback to set if marks that this box should take the full width/height of the canvas (moving other boxes).- Returns:
- the callback instance to use
-
setFullSize
public void setFullSize(FullSizeCallback<ChartContext> fullSizeCallback)
Sets if marks that this box should take the full width/height of the canvas (moving other boxes) is shown by a callback.- Parameters:
fullSizeCallback
- the callback instance to use
-
setFullSize
public void setFullSize(NativeCallback fullSizeCallback)
Sets if marks that this box should take the full width/height of the canvas (moving other boxes) is shown by a callback.- Parameters:
fullSizeCallback
- the callback instance to use
-
getPaddingCallback
public PaddingCallback<ChartContext> getPaddingCallback()
Returns the padding callback, if set, otherwisenull
.- Specified by:
getPaddingCallback
in interfaceIsScriptablePaddingProvider<ChartContext>
- Returns:
- the padding callback, if set, otherwise
null
.
-
setPadding
public void setPadding(PaddingCallback<ChartContext> paddingCallback)
Sets the padding callback.- Specified by:
setPadding
in interfaceIsScriptablePaddingProvider<ChartContext>
- Parameters:
paddingCallback
- the padding callback to set
-
setPadding
public void setPadding(NativeCallback paddingCallback)
Sets the padding callback.- Specified by:
setPadding
in interfaceIsScriptablePaddingProvider<ChartContext>
- Parameters:
paddingCallback
- the padding callback to set
-
getFontCallback
public FontCallback<ChartContext> getFontCallback()
Returns the font callback, if set, otherwisenull
.- Specified by:
getFontCallback
in interfaceIsScriptableFontProvider<ChartContext>
- Returns:
- the font callback, if set, otherwise
null
.
-
setFont
public void setFont(FontCallback<ChartContext> fontCallback)
Sets the font callback.- Specified by:
setFont
in interfaceIsScriptableFontProvider<ChartContext>
- Parameters:
fontCallback
- the font callback to set
-
setFont
public void setFont(NativeCallback fontCallback)
Sets the font callback.- Specified by:
setFont
in interfaceIsScriptableFontProvider<ChartContext>
- Parameters:
fontCallback
- the font callback to set
-
getColorCallback
public ColorCallback<ChartContext> getColorCallback()
Returns the color callback, if set, otherwisenull
.- Returns:
- the color callback, if set, otherwise
null
.
-
setColor
public void setColor(ColorCallback<ChartContext> colorCallback)
Sets the color callback.- Parameters:
colorCallback
- the color callback to set
-
setColor
public void setColor(NativeCallback colorCallback)
Sets the color callback.- Parameters:
colorCallback
- the color callback to set
-
getTextCallback
public TextCallback<ChartContext> getTextCallback()
Returns the text callback, if set, otherwisenull
.- Returns:
- the text callback, if set, otherwise
null
.
-
setText
public void setText(TextCallback<ChartContext> textCallback)
Sets the text callback.- Parameters:
textCallback
- the text callback to set
-
setText
public void setText(NativeCallback textCallback)
Sets the text callback.- Parameters:
textCallback
- the text callback to set
-
getPositionCallback
public PositionCallback<ChartContext> getPositionCallback()
Returns the position callback, if set, otherwisenull
.- Returns:
- the position callback, if set, otherwise
null
.
-
setPosition
public void setPosition(PositionCallback<ChartContext> positionCallback)
Sets the position callback.- Parameters:
positionCallback
- the position callback to set
-
setPosition
public void setPosition(NativeCallback positionCallback)
Sets the position callback.- Parameters:
positionCallback
- the position callback to set
-
getAlignCallback
public ElementAlignCallback<ChartContext> getAlignCallback()
Returns the align callback, if set, otherwisenull
.- Returns:
- the align callback, if set, otherwise
null
.
-
setAlign
public void setAlign(ElementAlignCallback<ChartContext> alignCallback)
Sets the align callback.- Parameters:
alignCallback
- the align callback to set
-
setAlign
public void setAlign(NativeCallback alignCallback)
Sets the align callback.- Parameters:
alignCallback
- the align callback to set
-
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
-
-