software.xdev.chartjs.model.options.Tooltip Maven / Gradle / Ivy
/*
* Copyright © 2023 XDEV Software (https://xdev.software)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package software.xdev.chartjs.model.options;
import software.xdev.chartjs.model.enums.FontStyle;
import software.xdev.chartjs.model.javascript.JavaScriptFunction;
public class Tooltip
{
protected Boolean enabled;
protected JavaScriptFunction external;
protected String mode;
protected JavaScriptFunction itemSort;
protected Object backgroundColor;
protected String titleFontFamily;
protected Integer titleFontSize;
protected FontStyle titleFontStyle;
protected Object titleFontColor;
protected Integer titleSpacing;
protected Integer titleMarginBottom;
protected String bodyFontFamily;
protected Integer bodyFontSize;
protected FontStyle bodyFontStyle;
protected Object bodyFontColor;
protected Integer bodySpacing;
protected String footerFontFamily;
protected Integer footerFontSize;
protected FontStyle footerFontStyle;
protected Object footerFontColor;
protected Integer footerSpacing;
protected Integer footerMarginTop;
protected Integer xPadding;
protected Integer yPadding;
protected Integer caretSize;
protected Integer cornerRadius;
protected Object multiKeyBackground;
protected Callbacks callbacks;
/**
* @see #setEnabled(Boolean)
*/
public Boolean getEnabled()
{
return this.enabled;
}
/**
*
* Are tooltips enabled
*
*
*
* Default {@code true}
*
*/
public Tooltip setEnabled(final Boolean enabled)
{
this.enabled = enabled;
return this;
}
/**
* @see #setExternal(JavaScriptFunction)
*/
public JavaScriptFunction getExternal()
{
return this.external;
}
/**
*
* See section below
*
*
*
* Default {@code null}
*
*/
public Tooltip setExternal(final JavaScriptFunction external)
{
this.external = external;
return this;
}
/**
* @see #setMode(String)
*/
public String getMode()
{
return this.mode;
}
/**
*
* Sets which elements appear in the tooltip. Acceptable options are 'single', 'label' or 'x-axis'. single
* highlights the closest element. label highlights elements in all datasets at the same X value. 'x-axis' also
* highlights elements in all datasets at the same X value, but activates when hovering anywhere within the
* vertical
* slice of the x-axis representing that X value.
*
*
*
* Default {@code 'single'}
*
*/
public Tooltip setMode(final String mode)
{
this.mode = mode;
return this;
}
/**
* @see #setItemSort(JavaScriptFunction)
*/
public JavaScriptFunction getItemSort()
{
return this.itemSort;
}
/**
*
* Allows sorting of tooltip items. Must implement a function that can be passed to Array.prototype.sort
*
*
*
* Default {@code undefined}
*
*/
public Tooltip setItemSort(final JavaScriptFunction itemSort)
{
this.itemSort = itemSort;
return this;
}
/**
* @see #setBackgroundColor(Object)
*/
public Object getBackgroundColor()
{
return this.backgroundColor;
}
/**
*
* Background color of the tooltip
*
*
*
* Default {@code 'rgba(0,0,0,0.8)'}
*
*/
public Tooltip setBackgroundColor(final Object backgroundColor)
{
this.backgroundColor = backgroundColor;
return this;
}
/**
* @see #setTitleFontFamily(String)
*/
public String getTitleFontFamily()
{
return this.titleFontFamily;
}
/**
*
* Font family for tooltip title inherited from global font family
*
*
*
* Default {@code "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif"}
*
*/
public Tooltip setTitleFontFamily(final String titleFontFamily)
{
this.titleFontFamily = titleFontFamily;
return this;
}
/**
* @see #setTitleFontSize(Integer)
*/
public Integer getTitleFontSize()
{
return this.titleFontSize;
}
/**
*
* Font size for tooltip title inherited from global font size
*
*
*
* Default {@code 12}
*
*/
public Tooltip setTitleFontSize(final Integer titleFontSize)
{
this.titleFontSize = titleFontSize;
return this;
}
/**
* @see #setTitleFontStyle(FontStyle)
*/
public FontStyle getTitleFontStyle()
{
return this.titleFontStyle;
}
/**
*
*
*
*
*
* Default {@code "bold"}
*
*/
public Tooltip setTitleFontStyle(final FontStyle titleFontStyle)
{
this.titleFontStyle = titleFontStyle;
return this;
}
/**
* @see #setTitleFontColor(Object)
*/
public Object getTitleFontColor()
{
return this.titleFontColor;
}
/**
*
* Font color for tooltip title
*
*
*
* Default {@code "#fff"}
*
*/
public Tooltip setTitleFontColor(final Object titleFontColor)
{
this.titleFontColor = titleFontColor;
return this;
}
/**
* @see #setTitleSpacing(Integer)
*/
public Integer getTitleSpacing()
{
return this.titleSpacing;
}
/**
*
* Spacing to add to top and bottom of each title line.
*
*
*
* Default {@code 2}
*
*/
public Tooltip setTitleSpacing(final Integer titleSpacing)
{
this.titleSpacing = titleSpacing;
return this;
}
/**
* @see #setTitleMarginBottom(Integer)
*/
public Integer getTitleMarginBottom()
{
return this.titleMarginBottom;
}
/**
*
* Margin to add on bottom of title section
*
*
*
* Default {@code 6}
*
*/
public Tooltip setTitleMarginBottom(final Integer titleMarginBottom)
{
this.titleMarginBottom = titleMarginBottom;
return this;
}
/**
* @see #setBodyFontFamily(String)
*/
public String getBodyFontFamily()
{
return this.bodyFontFamily;
}
/**
*
* Font family for tooltip items inherited from global font family
*
*
*
* Default {@code "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif"}
*
*/
public Tooltip setBodyFontFamily(final String bodyFontFamily)
{
this.bodyFontFamily = bodyFontFamily;
return this;
}
/**
* @see #setBodyFontSize(Integer)
*/
public Integer getBodyFontSize()
{
return this.bodyFontSize;
}
/**
*
* Font size for tooltip items inherited from global font size
*
*
*
* Default {@code 12}
*
*/
public Tooltip setBodyFontSize(final Integer bodyFontSize)
{
this.bodyFontSize = bodyFontSize;
return this;
}
/**
* @see #setBodyFontStyle(FontStyle)
*/
public FontStyle getBodyFontStyle()
{
return this.bodyFontStyle;
}
/**
*
*
*
*
*
* Default {@code "normal"}
*
*/
public Tooltip setBodyFontStyle(final FontStyle bodyFontStyle)
{
this.bodyFontStyle = bodyFontStyle;
return this;
}
/**
* @see #setBodyFontColor(Object)
*/
public Object getBodyFontColor()
{
return this.bodyFontColor;
}
/**
*
* Font color for tooltip items.
*
*
*
* Default {@code "#fff"}
*
*/
public Tooltip setBodyFontColor(final Object bodyFontColor)
{
this.bodyFontColor = bodyFontColor;
return this;
}
/**
* @see #setBodySpacing(Integer)
*/
public Integer getBodySpacing()
{
return this.bodySpacing;
}
/**
*
* Spacing to add to top and bottom of each tooltip item
*
*
*
* Default {@code 2}
*
*/
public Tooltip setBodySpacing(final Integer bodySpacing)
{
this.bodySpacing = bodySpacing;
return this;
}
/**
* @see #setFooterFontFamily(String)
*/
public String getFooterFontFamily()
{
return this.footerFontFamily;
}
/**
*
* Font family for tooltip footer inherited from global font family.
*
*
*
* Default {@code "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif"}
*
*/
public Tooltip setFooterFontFamily(final String footerFontFamily)
{
this.footerFontFamily = footerFontFamily;
return this;
}
/**
* @see #setFooterFontSize(Integer)
*/
public Integer getFooterFontSize()
{
return this.footerFontSize;
}
/**
*
* Font size for tooltip footer inherited from global font size.
*
*
*
* Default {@code 12}
*
*/
public Tooltip setFooterFontSize(final Integer footerFontSize)
{
this.footerFontSize = footerFontSize;
return this;
}
/**
* @see #setFooterFontStyle(FontStyle)
*/
public FontStyle getFooterFontStyle()
{
return this.footerFontStyle;
}
/**
*
* Font style for tooltip footer.
*
*
*
* Default {@code "bold"}
*
*/
public Tooltip setFooterFontStyle(final FontStyle footerFontStyle)
{
this.footerFontStyle = footerFontStyle;
return this;
}
/**
* @see #setFooterFontColor(Object)
*/
public Object getFooterFontColor()
{
return this.footerFontColor;
}
/**
*
* Font color for tooltip footer.
*
*
*
* Default {@code "#fff"}
*
*/
public Tooltip setFooterFontColor(final Object footerFontColor)
{
this.footerFontColor = footerFontColor;
return this;
}
/**
* @see #setFooterSpacing(Integer)
*/
public Integer getFooterSpacing()
{
return this.footerSpacing;
}
/**
*
* Spacing to add to top and bottom of each footer line.
*
*
*
* Default {@code 2}
*
*/
public Tooltip setFooterSpacing(final Integer footerSpacing)
{
this.footerSpacing = footerSpacing;
return this;
}
/**
* @see #setFooterMarginTop(Integer)
*/
public Integer getFooterMarginTop()
{
return this.footerMarginTop;
}
/**
*
* Margin to add before drawing the footer
*
*
*
* Default {@code 6}
*
*/
public Tooltip setFooterMarginTop(final Integer footerMarginTop)
{
this.footerMarginTop = footerMarginTop;
return this;
}
/**
* @see #setXPadding(Integer)
*/
public Integer getXPadding()
{
return this.xPadding;
}
/**
*
* Padding to add on left and right of tooltip
*
*
*
* Default {@code 6}
*
*/
public Tooltip setXPadding(final Integer xPadding)
{
this.xPadding = xPadding;
return this;
}
/**
* @see #setYPadding(Integer)
*/
public Integer getYPadding()
{
return this.yPadding;
}
/**
*
* Padding to add on top and bottom of tooltip
*
*
*
* Default {@code 6}
*
*/
public Tooltip setYPadding(final Integer yPadding)
{
this.yPadding = yPadding;
return this;
}
/**
* @see #setCaretSize(Integer)
*/
public Integer getCaretSize()
{
return this.caretSize;
}
/**
*
* Size, in px, of the tooltip arrow
*
*
*
* Default {@code 5}
*
*/
public Tooltip setCaretSize(final Integer caretSize)
{
this.caretSize = caretSize;
return this;
}
/**
* @see #setCornerRadius(Integer)
*/
public Integer getCornerRadius()
{
return this.cornerRadius;
}
/**
*
* Radius of tooltip corner curves
*
*
*
* Default {@code 6}
*
*/
public Tooltip setCornerRadius(final Integer cornerRadius)
{
this.cornerRadius = cornerRadius;
return this;
}
/**
* @see #setMultiKeyBackground(Object)
*/
public Object getMultiKeyBackground()
{
return this.multiKeyBackground;
}
/**
*
* Color to draw behind the colored boxes when multiple items are in the tooltip
*
*
*
* Default {@code "#fff"}
*
*/
public Tooltip setMultiKeyBackground(final Object multiKeyBackground)
{
this.multiKeyBackground = multiKeyBackground;
return this;
}
/**
* @see #setCallbacks(Callbacks)
*/
public Callbacks getCallbacks()
{
return this.callbacks;
}
/**
*
* See the callbacks section below
*
*
*
* Default {@code }
*
*/
public Tooltip setCallbacks(final Callbacks callbacks)
{
this.callbacks = callbacks;
return this;
}
}