Class Tooltips
- java.lang.Object
-
- org.pepstock.charba.client.configuration.Tooltips
-
- All Implemented Interfaces:
HasAnimation
public class Tooltips extends Object implements HasAnimation
Configuration element to set all attributes and features of the tooltip.- Author:
- Andrea "Stock" Stocchero
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedTooltips(ConfigurationOptions options)Builds the object storing the chart instance and the root options element.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AnimationContainergetAnimationContainer()Returns an animation container instance to use in the default methods of this interface.IsColorgetBackgroundColor()Returns the background color of the tooltip.StringgetBackgroundColorAsString()Returns the background color of the tooltip.TextAligngetBodyAlign()Returns the body alignment.IsColorgetBodyColor()Returns the body font color.StringgetBodyColorAsString()Returns the body font color as string.FontgetBodyFont()Returns the body font element.intgetBodySpacing()Returns the spacing to add to top and bottom of each tooltip item.IsColorgetBorderColor()Returns the color of the border.StringgetBorderColorAsString()Returns the color of the border.intgetBorderWidth()Returns the size of the border.intgetBoxHeight()Returns the height of the colored box if displayColors istrue..intgetBoxPadding()Returns the padding between the color box and the text.intgetBoxWidth()Returns the width of the colored box if displayColors istrue..TooltipsCallbacksgetCallbacks()Returns the object where all tooltips callbacks are stored.intgetCaretPadding()Returns the extra distance to move the end of the tooltip arrow away from the tooltip point.intgetCaretSize()Returns the size of the tooltip arrow, in pixels.IsChartgetChart()Returns the chart instanceprotected ExtendedOptionsgetConfiguration()Returns the configuration element.intgetCornerRadius()Returns the radius of tooltip corner curves.BarBorderRadiusgetCornerRadiusAsObject()Returns the radius of tooltip corner curves.Set<IsEvent>getEvents()Returns the browser events that the tooltip should listen to.TooltipExternalCallbackgetExternalCallback()Returns the user external callback instance.TooltipFilterCallbackgetFilterCallback()Returns the user filter callback instance.TextAligngetFooterAlign()Returns the footer alignment.IsColorgetFooterColor()Returns the footer font color.StringgetFooterColorAsString()Returns the footer font color as string.FontgetFooterFont()Returns the footer font element.intgetFooterMarginTop()Returns the margin to add before drawing the footer.intgetFooterSpacing()Returns the spacing to add to top and bottom of each footer line.TooltipItemSortCallbackgetItemSortCallback()Returns the user item sort callback instance.InteractionModegetMode()Returns which elements appear in the tooltip.IsColorgetMultiKeyBackground()Returns the color to draw behind the colored boxes when multiple items are in the tooltip.StringgetMultiKeyBackgroundAsString()Returns the color to draw behind the colored boxes when multiple items are in the tooltip.protected ConfigurationOptionsgetOptions()Returns the configuration options.PaddinggetPadding()Returns the object where all tooltips padding is stored.IsTooltipPositiongetPosition()Returns the mode for positioning the tooltip.TextDirectiongetTextDirection()Returns the text direction of the tooltip that will force the text direction on the canvas for rendering the tooltip, regardless of the CSS specified on the canvas.TextAligngetTitleAlign()Returns the title alignment.IsColorgetTitleColor()Returns the title font color.StringgetTitleColorAsString()Returns the title font color as string.FontgetTitleFont()Returns the title font element.intgetTitleMarginBottom()Returns the margin to add on bottom of title section.intgetTitleSpacing()Returns the spacing to add to top and bottom of each title line.TooltipAligngetXAlign()Returns the alignment of the tooltip caret in the X direction.TooltipAligngetYAlign()Returns the alignment of the tooltip caret in the Y direction.booleanisDisplayColors()If true, color boxes are shown in the tooltip.booleanisEnabled()Returns if tooltips are enabled.booleanisIntersect()if true, the tooltip mode applies only when the mouse position intersects with an element.booleanisRtl()Returnstruefor rendering the tooltips from right to left.booleanisUsePointStyle()Returns if to use the corresponding point style (from data set options) instead of color boxes (size is based on the minimum value between boxWidth and boxHeight).voidsetBackgroundColor(String backgroundColor)Sets the background color of the tooltip.voidsetBackgroundColor(IsColor backgroundColor)Sets the background color of the tooltip.voidsetBodyAlign(TextAlign align)Sets the body alignment.voidsetBodyColor(String color)Sets the body font color.voidsetBodyColor(IsColor color)Sets the body font color.voidsetBodySpacing(int bodySpacing)Sets the spacing to add to top and bottom of each tooltip item.voidsetBorderColor(String borderColor)Sets the color of the border.voidsetBorderColor(IsColor borderColor)Sets the color of the border.voidsetBorderWidth(int borderWidth)Sets the size of the border.voidsetBoxHeight(int boxHeight)Sets the height of the colored box if displayColors istrue..voidsetBoxPadding(int boxPadding)Sets the padding between the color box and the text.voidsetBoxWidth(int boxWidth)Sets the width of of the colored box if displayColors istrue..voidsetCaretPadding(int caretPadding)Sets the extra distance to move the end of the tooltip arrow away from the tooltip point.voidsetCaretSize(int caretSize)Sets the size of the tooltip arrow, in pixels.voidsetCornerRadius(int cornerRadius)Sets the radius of tooltip corner curves.voidsetCornerRadius(BarBorderRadius cornerRadius)Sets the radius of tooltip corner curves.voidsetDisplayColors(boolean displayColors)If true, color boxes are shown in the tooltip.voidsetEnabled(boolean enabled)Sets if tooltips are enabled.voidsetEvents(IsEvent... events)Sets the browser events that the tooltip should listen to.voidsetExternalCallback(TooltipExternalCallback externalCallback)Sets the user external callback instance.voidsetFilterCallback(TooltipFilterCallback filterCallback)Sets the user filter callback instance.voidsetFooterAlign(TextAlign align)Sets the footer alignment.voidsetFooterColor(String color)Sets the footer font color.voidsetFooterColor(IsColor color)Sets the footer font color.voidsetFooterMarginTop(int footerMarginTop)Sets the margin to add before drawing the footer.voidsetFooterSpacing(int footerSpacing)Sets the spacing to add to top and bottom of each footer line.voidsetIntersect(boolean intersect)if true, the tooltip mode applies only when the mouse position intersects with an element.voidsetItemSortCallback(TooltipItemSortCallback itemSortCallback)Sets the user item sort callback instance.voidsetMode(InteractionMode mode)Sets which elements appear in the tooltip.voidsetMultiKeyBackground(String multiKeyBackground)Sets the color to draw behind the colored boxes when multiple items are in the tooltip.voidsetMultiKeyBackground(IsColor multiKeyBackground)Sets the color to draw behind the colored boxes when multiple items are in the tooltip.voidsetPosition(IsTooltipPosition position)Sets the mode for positioning the tooltip.voidsetRtl(boolean rtl)Setstruefor rendering the tooltips from right to left.voidsetTextDirection(TextDirection textDirection)Sets the text direction of the tooltip that will force the text direction on the canvas for rendering the tooltip, regardless of the CSS specified on the canvas.voidsetTitleAlign(TextAlign align)Sets the title alignment.voidsetTitleColor(String color)Sets the title font color.voidsetTitleColor(IsColor color)Sets the title font color.voidsetTitleMarginBottom(int titleMarginBottom)Sets the margin to add on bottom of title section.voidsetTitleSpacing(int titleSpacing)Sets the spacing to add to top and bottom of each title line.voidsetUsePointStyle(boolean usePointStyle)Sets if to use the corresponding point style (from data set options) instead of color boxes (size is based on the minimum value between boxWidth and boxHeight).voidsetXAlign(TooltipAlign align)Sets the alignment of the tooltip caret in the X direction.voidsetYAlign(TooltipAlign align)Sets the alignment of the tooltip caret in the Y direction.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.pepstock.charba.client.configuration.HasAnimation
getAnimation, getAnimations, getTransitions, isAnimationEnabled, setAnimationEnabled
-
-
-
-
Constructor Detail
-
Tooltips
protected Tooltips(ConfigurationOptions options)
Builds the object storing the chart instance and the root options element.- Parameters:
options- root options element.
-
-
Method Detail
-
getAnimationContainer
public AnimationContainer getAnimationContainer()
Description copied from interface:HasAnimationReturns an animation container instance to use in the default methods of this interface.- Specified by:
getAnimationContainerin interfaceHasAnimation- Returns:
- an animation container instance
-
getCallbacks
public final TooltipsCallbacks getCallbacks()
Returns the object where all tooltips callbacks are stored.- Returns:
- the object where all tooltips callbacks are stored
-
getPadding
public final Padding getPadding()
Returns the object where all tooltips padding is stored.- Returns:
- the object where all tooltips padding is stored
-
setEnabled
public void setEnabled(boolean enabled)
Sets if tooltips are enabled.- Parameters:
enabled- if tooltips are enabled.
-
isEnabled
public boolean isEnabled()
Returns if tooltips are enabled.- Returns:
- if tooltips are enabled.
-
setEvents
public void setEvents(IsEvent... events)
Sets the browser events that the tooltip should listen to.- Parameters:
events- the browser events that the tooltip should listen to.
-
getEvents
public Set<IsEvent> getEvents()
Returns the browser events that the tooltip should listen to.- Returns:
- the browser events that the tooltip should listen to.
-
setMode
public void setMode(InteractionMode mode)
Sets which elements appear in the tooltip.- Parameters:
mode- which elements appear in the tooltip.
-
getMode
public InteractionMode getMode()
Returns which elements appear in the tooltip.- Returns:
- which elements appear in the tooltip.
-
setIntersect
public void setIntersect(boolean intersect)
if true, the tooltip mode applies only when the mouse position intersects with an element. If false, the mode will be applied at all times.- Parameters:
intersect- if true, the tooltip mode applies only when the mouse position intersects with an element. If false, the mode will be applied at all times.
-
isIntersect
public boolean isIntersect()
if true, the tooltip mode applies only when the mouse position intersects with an element. If false, the mode will be applied at all times.- Returns:
- if true, the tooltip mode applies only when the mouse position intersects with an element. If false, the mode will be applied at all times.
-
setPosition
public void setPosition(IsTooltipPosition position)
Sets the mode for positioning the tooltip.- Parameters:
position- the mode for positioning the tooltip.
-
getPosition
public IsTooltipPosition getPosition()
Returns the mode for positioning the tooltip.- Returns:
- mode for positioning the tooltip.
-
setBackgroundColor
public void setBackgroundColor(IsColor backgroundColor)
Sets the background color of the tooltip.- Parameters:
backgroundColor- background color of the tooltip.
-
setBackgroundColor
public void setBackgroundColor(String backgroundColor)
Sets the background color of the tooltip.- Parameters:
backgroundColor- background color of the tooltip.
-
getBackgroundColorAsString
public String getBackgroundColorAsString()
Returns the background color of the tooltip.- Returns:
- Background color of the tooltip.
-
getBackgroundColor
public IsColor getBackgroundColor()
Returns the background color of the tooltip.- Returns:
- Background color of the tooltip.
-
getTitleFont
public Font getTitleFont()
Returns the title font element.- Returns:
- the title font
-
setTitleColor
public void setTitleColor(IsColor color)
Sets the title font color.- Parameters:
color- title font color.
-
setTitleColor
public void setTitleColor(String color)
Sets the title font color.- Parameters:
color- title font color.
-
getTitleColorAsString
public String getTitleColorAsString()
Returns the title font color as string.- Returns:
- title font color as string
-
getTitleColor
public IsColor getTitleColor()
Returns the title font color.- Returns:
- title font color
-
setTitleAlign
public void setTitleAlign(TextAlign align)
Sets the title alignment.- Parameters:
align- title alignment.
-
getTitleAlign
public TextAlign getTitleAlign()
Returns the title alignment.- Returns:
- title alignment.
-
setTitleSpacing
public void setTitleSpacing(int titleSpacing)
Sets the spacing to add to top and bottom of each title line.- Parameters:
titleSpacing- spacing to add to top and bottom of each title line.
-
getTitleSpacing
public int getTitleSpacing()
Returns the spacing to add to top and bottom of each title line.- Returns:
- spacing to add to top and bottom of each title line.
-
setTitleMarginBottom
public void setTitleMarginBottom(int titleMarginBottom)
Sets the margin to add on bottom of title section.- Parameters:
titleMarginBottom- margin to add on bottom of title section.
-
getTitleMarginBottom
public int getTitleMarginBottom()
Returns the margin to add on bottom of title section.- Returns:
- margin to add on bottom of title section.
-
getBodyFont
public Font getBodyFont()
Returns the body font element.- Returns:
- the body font
-
setBodyColor
public void setBodyColor(IsColor color)
Sets the body font color.- Parameters:
color- body font color.
-
setBodyColor
public void setBodyColor(String color)
Sets the body font color.- Parameters:
color- body font color.
-
getBodyColorAsString
public String getBodyColorAsString()
Returns the body font color as string.- Returns:
- body font color as string
-
getBodyColor
public IsColor getBodyColor()
Returns the body font color.- Returns:
- body font color
-
setBodyAlign
public void setBodyAlign(TextAlign align)
Sets the body alignment.- Parameters:
align- body alignment.
-
getBodyAlign
public TextAlign getBodyAlign()
Returns the body alignment.- Returns:
- body alignment.
-
setBodySpacing
public void setBodySpacing(int bodySpacing)
Sets the spacing to add to top and bottom of each tooltip item.- Parameters:
bodySpacing- spacing to add to top and bottom of each tooltip item.
-
getBodySpacing
public int getBodySpacing()
Returns the spacing to add to top and bottom of each tooltip item.- Returns:
- spacing to add to top and bottom of each tooltip item.
-
getFooterFont
public Font getFooterFont()
Returns the footer font element.- Returns:
- the footer font
-
setFooterColor
public void setFooterColor(IsColor color)
Sets the footer font color.- Parameters:
color- footer font color.
-
setFooterColor
public void setFooterColor(String color)
Sets the footer font color.- Parameters:
color- footer font color.
-
getFooterColorAsString
public String getFooterColorAsString()
Returns the footer font color as string.- Returns:
- footer font color as string
-
getFooterColor
public IsColor getFooterColor()
Returns the footer font color.- Returns:
- footer font color
-
setFooterAlign
public void setFooterAlign(TextAlign align)
Sets the footer alignment.- Parameters:
align- footer alignment.
-
getFooterAlign
public TextAlign getFooterAlign()
Returns the footer alignment.- Returns:
- footer alignment.
-
setFooterSpacing
public void setFooterSpacing(int footerSpacing)
Sets the spacing to add to top and bottom of each footer line.- Parameters:
footerSpacing- spacing to add to top and bottom of each footer line.
-
getFooterSpacing
public int getFooterSpacing()
Returns the spacing to add to top and bottom of each footer line.- Returns:
- spacing to add to top and bottom of each footer line.
-
setFooterMarginTop
public void setFooterMarginTop(int footerMarginTop)
Sets the margin to add before drawing the footer.- Parameters:
footerMarginTop- margin to add before drawing the footer.
-
getFooterMarginTop
public int getFooterMarginTop()
Returns the margin to add before drawing the footer.- Returns:
- margin to add before drawing the footer.
-
setCaretPadding
public void setCaretPadding(int caretPadding)
Sets the extra distance to move the end of the tooltip arrow away from the tooltip point.- Parameters:
caretPadding- extra distance to move the end of the tooltip arrow away from the tooltip point.
-
getCaretPadding
public int getCaretPadding()
Returns the extra distance to move the end of the tooltip arrow away from the tooltip point.- Returns:
- extra distance to move the end of the tooltip arrow away from the tooltip point.
-
setCaretSize
public void setCaretSize(int caretSize)
Sets the size of the tooltip arrow, in pixels.- Parameters:
caretSize- size of the tooltip arrow, in pixels.
-
getCaretSize
public int getCaretSize()
Returns the size of the tooltip arrow, in pixels.- Returns:
- size of the tooltip arrow, in pixels
-
setCornerRadius
public void setCornerRadius(int cornerRadius)
Sets the radius of tooltip corner curves.- Parameters:
cornerRadius- radius of tooltip corner curves.
-
setCornerRadius
public void setCornerRadius(BarBorderRadius cornerRadius)
Sets the radius of tooltip corner curves.- Parameters:
cornerRadius- radius of tooltip corner curves.
-
getCornerRadius
public int getCornerRadius()
Returns the radius of tooltip corner curves.- Returns:
- radius of tooltip corner curves.
-
getCornerRadiusAsObject
public BarBorderRadius getCornerRadiusAsObject()
Returns the radius of tooltip corner curves.- Returns:
- radius of tooltip corner curves.
-
setMultiKeyBackground
public void setMultiKeyBackground(IsColor multiKeyBackground)
Sets the color to draw behind the colored boxes when multiple items are in the tooltip.- Parameters:
multiKeyBackground- color to draw behind the colored boxes when multiple items are in the tooltip.
-
setMultiKeyBackground
public void setMultiKeyBackground(String multiKeyBackground)
Sets the color to draw behind the colored boxes when multiple items are in the tooltip.- Parameters:
multiKeyBackground- color to draw behind the colored boxes when multiple items are in the tooltip.
-
getMultiKeyBackgroundAsString
public String getMultiKeyBackgroundAsString()
Returns the color to draw behind the colored boxes when multiple items are in the tooltip.- Returns:
- color to draw behind the colored boxes when multiple items are in the tooltip.
-
getMultiKeyBackground
public IsColor getMultiKeyBackground()
Returns the color to draw behind the colored boxes when multiple items are in the tooltip.- Returns:
- color to draw behind the colored boxes when multiple items are in the tooltip.
-
setDisplayColors
public void setDisplayColors(boolean displayColors)
If true, color boxes are shown in the tooltip.- Parameters:
displayColors- if true, color boxes are shown in the tooltip.
-
isDisplayColors
public boolean isDisplayColors()
If true, color boxes are shown in the tooltip.- Returns:
- if true, color boxes are shown in the tooltip.
-
setBorderColor
public void setBorderColor(IsColor borderColor)
Sets the color of the border.- Parameters:
borderColor- color of the border.
-
setBorderColor
public void setBorderColor(String borderColor)
Sets the color of the border.- Parameters:
borderColor- color of the border.
-
getBorderColorAsString
public String getBorderColorAsString()
Returns the color of the border.- Returns:
- color of the border.
-
getBorderColor
public IsColor getBorderColor()
Returns the color of the border.- Returns:
- color of the border.
-
setBorderWidth
public void setBorderWidth(int borderWidth)
Sets the size of the border.- Parameters:
borderWidth- size of the border.
-
getBorderWidth
public int getBorderWidth()
Returns the size of the border.- Returns:
- size of the border.
-
setBoxWidth
public void setBoxWidth(int boxWidth)
Sets the width of of the colored box if displayColors istrue..- Parameters:
boxWidth- width of colored box.
-
getBoxWidth
public int getBoxWidth()
Returns the width of the colored box if displayColors istrue..- Returns:
- width of colored box.
-
setBoxHeight
public void setBoxHeight(int boxHeight)
Sets the height of the colored box if displayColors istrue..- Parameters:
boxHeight- width of colored box.
-
getBoxHeight
public int getBoxHeight()
Returns the height of the colored box if displayColors istrue..- Returns:
- height of colored box.
-
setRtl
public void setRtl(boolean rtl)
Setstruefor rendering the tooltips from right to left.- Parameters:
rtl-truefor rendering the tooltips from right to left
-
isRtl
public boolean isRtl()
Returnstruefor rendering the tooltips from right to left.- Returns:
truefor rendering the tooltips from right to left.
-
setTextDirection
public void setTextDirection(TextDirection textDirection)
Sets the text direction of the tooltip that will force the text direction on the canvas for rendering the tooltip, regardless of the CSS specified on the canvas.- Parameters:
textDirection- the text direction of the tooltip.
-
getTextDirection
public TextDirection getTextDirection()
Returns the text direction of the tooltip that will force the text direction on the canvas for rendering the tooltip, regardless of the CSS specified on the canvas.- Returns:
- the text direction of the tooltip.
-
setUsePointStyle
public void setUsePointStyle(boolean usePointStyle)
Sets if to use the corresponding point style (from data set options) instead of color boxes (size is based on the minimum value between boxWidth and boxHeight).- Parameters:
usePointStyle-trueif to use the corresponding point style (from data set options) instead of color boxes (size is based on the minimum value between boxWidth and boxHeight)
-
isUsePointStyle
public boolean isUsePointStyle()
Returns if to use the corresponding point style (from data set options) instead of color boxes (size is based on the minimum value between boxWidth and boxHeight).- Returns:
trueif to use the corresponding point style (from data set options) instead of color boxes (size is based on the minimum value between boxWidth and boxHeight)
-
setXAlign
public void setXAlign(TooltipAlign align)
Sets the alignment of the tooltip caret in the X direction.- Parameters:
align- the alignment of the tooltip caret in the X direction.
-
getXAlign
public TooltipAlign getXAlign()
Returns the alignment of the tooltip caret in the X direction.- Returns:
- the alignment of the tooltip caret in the X direction
-
setYAlign
public void setYAlign(TooltipAlign align)
Sets the alignment of the tooltip caret in the Y direction.- Parameters:
align- the alignment of the tooltip caret in the Y direction.
-
getYAlign
public TooltipAlign getYAlign()
Returns the alignment of the tooltip caret in the Y direction.- Returns:
- the alignment of the tooltip caret in the Y direction
-
setBoxPadding
public void setBoxPadding(int boxPadding)
Sets the padding between the color box and the text.- Parameters:
boxPadding- padding between the color box and the text
-
getBoxPadding
public int getBoxPadding()
Returns the padding between the color box and the text.- Returns:
- padding between the color box and the text
-
getExternalCallback
public TooltipExternalCallback getExternalCallback()
Returns the user external callback instance.- Returns:
- the user external callback instance
-
setExternalCallback
public void setExternalCallback(TooltipExternalCallback externalCallback)
Sets the user external callback instance.- Parameters:
externalCallback- the user external callback instance
-
getItemSortCallback
public TooltipItemSortCallback getItemSortCallback()
Returns the user item sort callback instance.- Returns:
- the user item sort callback instance
-
setItemSortCallback
public void setItemSortCallback(TooltipItemSortCallback itemSortCallback)
Sets the user item sort callback instance.- Parameters:
itemSortCallback- the user item sort callback instance
-
getFilterCallback
public TooltipFilterCallback getFilterCallback()
Returns the user filter callback instance.- Returns:
- the user filter callback instance
-
setFilterCallback
public void setFilterCallback(TooltipFilterCallback filterCallback)
Sets the user filter callback instance.- Parameters:
filterCallback- the user filter 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
-
-