Class 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 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: HasAnimation
        Returns an animation container instance to use in the default methods of this interface.
        Specified by:
        getAnimationContainer in interface HasAnimation
        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.
      • setEvents

        public void setEvents​(Set<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 is true..
        Parameters:
        boxWidth - width of colored box.
      • getBoxWidth

        public int getBoxWidth()
        Returns the width of the colored box if displayColors is true..
        Returns:
        width of colored box.
      • setBoxHeight

        public void setBoxHeight​(int boxHeight)
        Sets the height of the colored box if displayColors is true..
        Parameters:
        boxHeight - width of colored box.
      • getBoxHeight

        public int getBoxHeight()
        Returns the height of the colored box if displayColors is true..
        Returns:
        height of colored box.
      • setRtl

        public void setRtl​(boolean rtl)
        Sets true for rendering the tooltips from right to left.
        Parameters:
        rtl - true for rendering the tooltips from right to left
      • isRtl

        public boolean isRtl()
        Returns true for rendering the tooltips from right to left.
        Returns:
        true for 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 - true 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)
      • 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:
        true 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)
      • 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