Class Bar
- java.lang.Object
-
- org.pepstock.charba.client.configuration.Bar
-
public class Bar extends Object
Bar elements are used to represent the bars in a bar chart.- Author:
- Andrea "Stock" Stocchero
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IsColor
getBackgroundColor()
Returns the background color.String
getBackgroundColorAsString()
Returns the background color.ColorCallback<DatasetContext>
getBackgroundColorCallback()
Returns the background color callback, if set, otherwisenull
.double
getBase()
Returns the base value for the bar in data units along the value axis.
If not set, defaults to the value axis base value.IsColor
getBorderColor()
Returns the border color.String
getBorderColorAsString()
Returns the border color.ColorCallback<DatasetContext>
getBorderColorCallback()
Returns the border color callback, if set, otherwisenull
.int
getBorderRadius()
Returns the bar border radius (in pixels).BorderRadiusCallback<DatasetContext>
getBorderRadiusCallback()
Returns the border radius callback, if set, otherwisenull
.BorderSkipped
getBorderSkipped()
Returns the edge to skip drawing the border for.BorderSkippedCallback
getBorderSkippedCallback()
Returns the border skipped callback, if set, otherwisenull
.int
getBorderWidth()
Returns the border width.WidthCallback<DatasetContext>
getBorderWidthCallback()
Returns the border width callback, if set, otherwisenull
.IsChart
getChart()
Returns the chart instanceprotected ExtendedOptions
getConfiguration()
Returns the configuration element.protected IsDefaultBar
getDefaultElement()
Returns the element instance to be managed.protected AbstractElement<IsDefaultBar>
getElement()
Returns the element instance to be managed.EnableBorderRadiusCallback
getEnableBorderRadiusCallback()
Returns the enable border radius callback, if set, otherwisenull
.IsColor
getHoverBackgroundColor()
Returns the background color when hovered.String
getHoverBackgroundColorAsString()
Returns the background color when hovered.ColorCallback<DatasetContext>
getHoverBackgroundColorCallback()
Returns the background color callback, if set, otherwisenull
.IsColor
getHoverBorderColor()
Returns the border color when hovered.String
getHoverBorderColorAsString()
Returns the border color when hovered.ColorCallback<DatasetContext>
getHoverBorderColorCallback()
Returns the border color callback, if set, otherwisenull
.int
getHoverBorderRadius()
Returns the bar border radius (in pixels) when hovered.BorderRadiusCallback<DatasetContext>
getHoverBorderRadiusCallback()
Returns the border radius callback, when hovered, if set, otherwisenull
.int
getHoverBorderWidth()
Returns the border width when hovered.WidthCallback<DatasetContext>
getHoverBorderWidthCallback()
Returns the border width callback, if set, otherwisenull
.int
getInflateAmount()
Returns the amount of pixels to inflate the bar rectangles, when drawing.InflateAmountCallback
getInflateAmountCallback()
Returns the inflate amount callback, if set, otherwisenull
.protected ConfigurationOptions
getOptions()
Returns the configuration options.PointStyle
getPointStyle()
Returns the style of the point.Canvas
getPointStyleAsCanvas()
Returns the style of the point as canvas.Img
getPointStyleAsImage()
Returns the style of the point as image.PointStyleCallback<DatasetContext>
getPointStyleCallback()
Returns the point style callback, if set, otherwisenull
.PointStyleType
getPointStyleType()
Returns the type of point style.boolean
isAutoInflateAmount()
Returnstrue
if the amount of pixels to inflate the bar rectangles, when drawing, is automatically calculated.boolean
isEnableBorderRadius()
Iftrue
, it only shows the borderRadius of a bar when the bar is at the end of the stack.void
setAutoInflateAmount(boolean autoInflateAmount)
Setstrue
if the amount of pixels to inflate the bar rectangles, when drawing, is automatically calculated.void
setBackgroundColor(String backgroundColor)
Sets the background color.void
setBackgroundColor(ColorCallback<DatasetContext> backgroundColorCallback)
Sets the background color callback.void
setBackgroundColor(NativeCallback backgroundColorCallback)
Sets the background color callback.void
setBackgroundColor(IsColor backgroundColor)
Sets the background color.void
setBase(double base)
Sets the base value for the bar in data units along the value axis.
If not set, defaults to the value axis base value.void
setBorderColor(String borderColor)
Sets the border color.void
setBorderColor(ColorCallback<DatasetContext> borderColorCallback)
Sets the border color callback.void
setBorderColor(NativeCallback borderColorCallback)
Sets the border color callback.void
setBorderColor(IsColor borderColor)
Sets the border color.void
setBorderRadius(int borderRadius)
Sets the bar border radius (in pixels).void
setBorderRadius(BorderRadiusCallback<DatasetContext> borderRadiusCallback)
Sets the border radius callback.void
setBorderRadius(NativeCallback borderRadiusCallback)
Sets the border radius callback.void
setBorderSkipped(boolean borderSkipped)
Sets the edge to skip drawing the border for.void
setBorderSkipped(BorderSkippedCallback borderSkippedCallback)
Sets the border skipped callback.void
setBorderSkipped(NativeCallback borderSkippedCallback)
Sets the border skipped callback.void
setBorderSkipped(BorderSkipped borderSkipped)
Sets the edge to skip drawing the border for.void
setBorderWidth(int borderWidth)
Sets the border width.void
setBorderWidth(NativeCallback borderWidthCallback)
Sets the border width callback.void
setBorderWidth(WidthCallback<DatasetContext> borderWidthCallback)
Sets the border width callback.void
setEnableBorderRadius(boolean enableBorderRadius)
Iftrue
, it only shows the borderRadius of a bar when the bar is at the end of the stack.void
setEnableBorderRadius(EnableBorderRadiusCallback enableBorderRadiusCallback)
Sets the enable border radius callback.void
setEnableBorderRadius(NativeCallback enableBorderRadiusCallback)
Sets the enable border radius callback.void
setHoverBackgroundColor(String backgroundColor)
Sets the background color when hovered.void
setHoverBackgroundColor(ColorCallback<DatasetContext> hoverBackgroundColorCallback)
Sets the background color callback, as hovered.void
setHoverBackgroundColor(NativeCallback hoverBackgroundColorCallback)
Sets the background color callback, as hovered.void
setHoverBackgroundColor(IsColor backgroundColor)
Sets the background color when hovered.void
setHoverBorderColor(String borderColor)
Sets the border color when hovered.void
setHoverBorderColor(ColorCallback<DatasetContext> hoverBorderColorCallback)
Sets the border color callback, as hovered.void
setHoverBorderColor(NativeCallback hoverBorderColorCallback)
Sets the border color callback, as hovered.void
setHoverBorderColor(IsColor borderColor)
Sets the border color when hovered.void
setHoverBorderRadius(int borderRadius)
Sets the bar border radius (in pixels) when hovered.void
setHoverBorderRadius(BorderRadiusCallback<DatasetContext> hoverBorderRadiusCallback)
Sets the border radius callback, when hovered.void
setHoverBorderRadius(NativeCallback hoverBorderRadiusCallback)
Sets the border radius callback, when hovered.void
setHoverBorderWidth(int borderWidth)
Sets the border width when hovered.void
setHoverBorderWidth(NativeCallback hoverBorderWidthCallback)
Sets the border width callback, as hovered.void
setHoverBorderWidth(WidthCallback<DatasetContext> hoverBorderWidthCallback)
Sets the border width callback, as hovered.void
setInflateAmount(int inflateAmount)
Sets the amount of pixels to inflate the bar rectangles, when drawing.void
setInflateAmount(InflateAmountCallback inflateAmountCallback)
Sets the inflate amount callback.void
setInflateAmount(NativeCallback inflateAmountCallback)
Sets the inflate amount callback.void
setPointStyle(NativeCallback pointStyleCallback)
Sets the point style callback.void
setPointStyle(PointStyleCallback<DatasetContext> pointStyleCallback)
Sets the point style callback.void
setPointStyle(Canvas pointStyle)
Sets the style of the point as canvas.void
setPointStyle(Img pointStyle)
Sets the style of the point as image.void
setPointStyle(PointStyle pointStyle)
Sets the style of the point.
-
-
-
Method Detail
-
getElement
protected AbstractElement<IsDefaultBar> getElement()
Returns the element instance to be managed.- Returns:
- the element instance to be managed
-
getDefaultElement
protected IsDefaultBar getDefaultElement()
Returns the element instance to be managed.- Returns:
- the element instance to be managed
-
setBase
public void setBase(double base)
Sets the base value for the bar in data units along the value axis.
If not set, defaults to the value axis base value.- Parameters:
base
- base value for the bar in data units along the value axis.
If not set, defaults to the value axis base value
-
getBase
public double getBase()
Returns the base value for the bar in data units along the value axis.
If not set, defaults to the value axis base value.- Returns:
- base value for the bar in data units along the value axis.
If not set, defaults to the value axis base value
-
setBorderSkipped
public void setBorderSkipped(boolean borderSkipped)
Sets the edge to skip drawing the border for.- Parameters:
borderSkipped
- to setfalse
as border skipped. If settrue
, is ignored
-
setBorderSkipped
public void setBorderSkipped(BorderSkipped borderSkipped)
Sets the edge to skip drawing the border for.- Parameters:
borderSkipped
- the edge to skip drawing the border for.
-
getBorderSkipped
public BorderSkipped getBorderSkipped()
Returns the edge to skip drawing the border for.- Returns:
- the edge to skip drawing the border for.
-
setBorderRadius
public void setBorderRadius(int borderRadius)
Sets the bar border radius (in pixels).- Parameters:
borderRadius
- the bar border radius (in pixels).
-
getBorderRadius
public int getBorderRadius()
Returns the bar border radius (in pixels).- Returns:
- the bar border radius (in pixels).
-
setHoverBorderRadius
public void setHoverBorderRadius(int borderRadius)
Sets the bar border radius (in pixels) when hovered.- Parameters:
borderRadius
- the bar border radius (in pixels) when hovered.
-
getHoverBorderRadius
public int getHoverBorderRadius()
Returns the bar border radius (in pixels) when hovered.- Returns:
- the bar border radius (in pixels) when hovered.
-
setPointStyle
public void setPointStyle(PointStyle pointStyle)
Sets the style of the point.- Parameters:
pointStyle
- the style of the point.
-
setPointStyle
public void setPointStyle(Img pointStyle)
Sets the style of the point as image.- Parameters:
pointStyle
- the style of the point.
-
setPointStyle
public void setPointStyle(Canvas pointStyle)
Sets the style of the point as canvas.- Parameters:
pointStyle
- the style of the point.
-
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 point.- Returns:
- the style of the point.
-
getPointStyleAsImage
public Img getPointStyleAsImage()
Returns the style of the point as image.- Returns:
- the style of the point as image.
-
getPointStyleAsCanvas
public Canvas getPointStyleAsCanvas()
Returns the style of the point as canvas.- Returns:
- the style of the point as canvas.
-
setEnableBorderRadius
public void setEnableBorderRadius(boolean enableBorderRadius)
Iftrue
, it only shows the borderRadius of a bar when the bar is at the end of the stack.- Parameters:
enableBorderRadius
- iftrue
, it only shows the borderRadius of a bar when the bar is at the end of the stack
-
isEnableBorderRadius
public boolean isEnableBorderRadius()
Iftrue
, it only shows the borderRadius of a bar when the bar is at the end of the stack.- Returns:
- if
true
, it only shows the borderRadius of a bar when the bar is at the end of the stack
-
setAutoInflateAmount
public void setAutoInflateAmount(boolean autoInflateAmount)
Setstrue
if the amount of pixels to inflate the bar rectangles, when drawing, is automatically calculated.- Parameters:
autoInflateAmount
-true
if the amount of pixels to inflate the bar rectangles, when drawing, is automatically calculated
-
isAutoInflateAmount
public boolean isAutoInflateAmount()
Returnstrue
if the amount of pixels to inflate the bar rectangles, when drawing, is automatically calculated.- Returns:
true
if the amount of pixels to inflate the bar rectangles, when drawing, is automatically calculated
-
setInflateAmount
public void setInflateAmount(int inflateAmount)
Sets the amount of pixels to inflate the bar rectangles, when drawing.- Parameters:
inflateAmount
- the amount of pixels to inflate the bar rectangles, when drawing
-
getInflateAmount
public int getInflateAmount()
Returns the amount of pixels to inflate the bar rectangles, when drawing.- Returns:
- the amount of pixels to inflate the bar rectangles, when drawing
-
getBorderRadiusCallback
public BorderRadiusCallback<DatasetContext> getBorderRadiusCallback()
Returns the border radius callback, if set, otherwisenull
.- Returns:
- the border radius callback, if set, otherwise
null
.
-
setBorderRadius
public void setBorderRadius(BorderRadiusCallback<DatasetContext> borderRadiusCallback)
Sets the border radius callback.- Parameters:
borderRadiusCallback
- the border radius callback.
-
setBorderRadius
public void setBorderRadius(NativeCallback borderRadiusCallback)
Sets the border radius callback.- Parameters:
borderRadiusCallback
- the border radius callback.
-
getHoverBorderRadiusCallback
public BorderRadiusCallback<DatasetContext> getHoverBorderRadiusCallback()
Returns the border radius callback, when hovered, if set, otherwisenull
.- Returns:
- the border radius callback, when hovered, if set, otherwise
null
.
-
setHoverBorderRadius
public void setHoverBorderRadius(BorderRadiusCallback<DatasetContext> hoverBorderRadiusCallback)
Sets the border radius callback, when hovered.- Parameters:
hoverBorderRadiusCallback
- the border radius callback, when hovered.
-
setHoverBorderRadius
public void setHoverBorderRadius(NativeCallback hoverBorderRadiusCallback)
Sets the border radius callback, when hovered.- Parameters:
hoverBorderRadiusCallback
- the border radius callback, when hovered.
-
getBorderSkippedCallback
public BorderSkippedCallback getBorderSkippedCallback()
Returns the border skipped callback, if set, otherwisenull
.- Returns:
- the border skipped callback, if set, otherwise
null
.
-
setBorderSkipped
public void setBorderSkipped(BorderSkippedCallback borderSkippedCallback)
Sets the border skipped callback.- Parameters:
borderSkippedCallback
- the border skipped callback.
-
setBorderSkipped
public void setBorderSkipped(NativeCallback borderSkippedCallback)
Sets the border skipped callback.- Parameters:
borderSkippedCallback
- the border skipped callback.
-
getEnableBorderRadiusCallback
public EnableBorderRadiusCallback getEnableBorderRadiusCallback()
Returns the enable border radius callback, if set, otherwisenull
.- Returns:
- the enable border radius callback, if set, otherwise
null
.
-
setEnableBorderRadius
public void setEnableBorderRadius(EnableBorderRadiusCallback enableBorderRadiusCallback)
Sets the enable border radius callback.- Parameters:
enableBorderRadiusCallback
- the enable border radius callback.
-
setEnableBorderRadius
public void setEnableBorderRadius(NativeCallback enableBorderRadiusCallback)
Sets the enable border radius callback.- Parameters:
enableBorderRadiusCallback
- the enable border radius callback.
-
getPointStyleCallback
public PointStyleCallback<DatasetContext> getPointStyleCallback()
Returns the point style callback, if set, otherwisenull
.- Returns:
- the point style callback, if set, otherwise
null
.
-
setPointStyle
public void setPointStyle(PointStyleCallback<DatasetContext> pointStyleCallback)
Sets the point style callback.- Parameters:
pointStyleCallback
- the point style callback.
-
setPointStyle
public void setPointStyle(NativeCallback pointStyleCallback)
Sets the point style callback.- Parameters:
pointStyleCallback
- the point style callback.
-
getInflateAmountCallback
public InflateAmountCallback getInflateAmountCallback()
Returns the inflate amount callback, if set, otherwisenull
.- Returns:
- the inflate amount callback, if set, otherwise
null
.
-
setInflateAmount
public void setInflateAmount(InflateAmountCallback inflateAmountCallback)
Sets the inflate amount callback.- Parameters:
inflateAmountCallback
- the inflate amount callback.
-
setInflateAmount
public void setInflateAmount(NativeCallback inflateAmountCallback)
Sets the inflate amount callback.- Parameters:
inflateAmountCallback
- the inflate amount callback.
-
setBackgroundColor
public void setBackgroundColor(IsColor backgroundColor)
Sets the background color.- Parameters:
backgroundColor
- the background color.
-
setBackgroundColor
public void setBackgroundColor(String backgroundColor)
Sets the background color.- Parameters:
backgroundColor
- the background color.
-
getBackgroundColorAsString
public String getBackgroundColorAsString()
Returns the background color.- Returns:
- the background color.
-
getBackgroundColor
public IsColor getBackgroundColor()
Returns the background color.- Returns:
- the background color.
-
setBorderWidth
public void setBorderWidth(int borderWidth)
Sets the border width.- Parameters:
borderWidth
- the border width.
-
getBorderWidth
public int getBorderWidth()
Returns the border width.- Returns:
- the border width.
-
setBorderColor
public void setBorderColor(IsColor borderColor)
Sets the border color.- Parameters:
borderColor
- the border color.
-
setBorderColor
public void setBorderColor(String borderColor)
Sets the border color.- Parameters:
borderColor
- the border color.
-
getBorderColorAsString
public String getBorderColorAsString()
Returns the border color.- Returns:
- the border color.
-
getBorderColor
public IsColor getBorderColor()
Returns the border color.- Returns:
- the border color.
-
setHoverBackgroundColor
public void setHoverBackgroundColor(IsColor backgroundColor)
Sets the background color when hovered.- Parameters:
backgroundColor
- the background color when hovered.
-
setHoverBackgroundColor
public void setHoverBackgroundColor(String backgroundColor)
Sets the background color when hovered.- Parameters:
backgroundColor
- the background color when hovered.
-
getHoverBackgroundColorAsString
public String getHoverBackgroundColorAsString()
Returns the background color when hovered.- Returns:
- the background color when hovered.
-
getHoverBackgroundColor
public IsColor getHoverBackgroundColor()
Returns the background color when hovered.- Returns:
- the background color when hovered.
-
setHoverBorderWidth
public void setHoverBorderWidth(int borderWidth)
Sets the border width when hovered.- Parameters:
borderWidth
- the border width when hovered.
-
getHoverBorderWidth
public int getHoverBorderWidth()
Returns the border width when hovered.- Returns:
- the border width when hovered.
-
setHoverBorderColor
public void setHoverBorderColor(IsColor borderColor)
Sets the border color when hovered.- Parameters:
borderColor
- the border color when hovered.
-
setHoverBorderColor
public void setHoverBorderColor(String borderColor)
Sets the border color when hovered.- Parameters:
borderColor
- the border color when hovered.
-
getHoverBorderColorAsString
public String getHoverBorderColorAsString()
Returns the border color when hovered.- Returns:
- the border color when hovered.
-
getHoverBorderColor
public IsColor getHoverBorderColor()
Returns the border color when hovered.- Returns:
- the border color when hovered.
-
getBackgroundColorCallback
public ColorCallback<DatasetContext> getBackgroundColorCallback()
Returns the background color callback, if set, otherwisenull
.- Returns:
- the background color callback, if set, otherwise
null
.
-
setBackgroundColor
public void setBackgroundColor(ColorCallback<DatasetContext> backgroundColorCallback)
Sets the background color callback.- Parameters:
backgroundColorCallback
- the background color callback.
-
setBackgroundColor
public void setBackgroundColor(NativeCallback backgroundColorCallback)
Sets the background color callback.- Parameters:
backgroundColorCallback
- the background color callback.
-
getBorderColorCallback
public ColorCallback<DatasetContext> getBorderColorCallback()
Returns the border color callback, if set, otherwisenull
.- Returns:
- the border color callback, if set, otherwise
null
.
-
setBorderColor
public void setBorderColor(ColorCallback<DatasetContext> borderColorCallback)
Sets the border color callback.- Parameters:
borderColorCallback
- the border color callback.
-
setBorderColor
public void setBorderColor(NativeCallback borderColorCallback)
Sets the border color callback.- Parameters:
borderColorCallback
- the border color callback.
-
getBorderWidthCallback
public WidthCallback<DatasetContext> getBorderWidthCallback()
Returns the border width callback, if set, otherwisenull
.- Returns:
- the border width callback, if set, otherwise
null
.
-
setBorderWidth
public void setBorderWidth(WidthCallback<DatasetContext> borderWidthCallback)
Sets the border width callback.- Parameters:
borderWidthCallback
- the border width callback.
-
setBorderWidth
public void setBorderWidth(NativeCallback borderWidthCallback)
Sets the border width callback.- Parameters:
borderWidthCallback
- the border width callback.
-
getHoverBackgroundColorCallback
public ColorCallback<DatasetContext> getHoverBackgroundColorCallback()
Returns the background color callback, if set, otherwisenull
.- Returns:
- the background color callback, if set, otherwise
null
.
-
setHoverBackgroundColor
public void setHoverBackgroundColor(ColorCallback<DatasetContext> hoverBackgroundColorCallback)
Sets the background color callback, as hovered.- Parameters:
hoverBackgroundColorCallback
- the background color callback, as hovered
-
setHoverBackgroundColor
public void setHoverBackgroundColor(NativeCallback hoverBackgroundColorCallback)
Sets the background color callback, as hovered.- Parameters:
hoverBackgroundColorCallback
- the background color callback, as hovered
-
getHoverBorderColorCallback
public ColorCallback<DatasetContext> getHoverBorderColorCallback()
Returns the border color callback, if set, otherwisenull
.- Returns:
- the border color callback, if set, otherwise
null
.
-
setHoverBorderColor
public void setHoverBorderColor(ColorCallback<DatasetContext> hoverBorderColorCallback)
Sets the border color callback, as hovered.- Parameters:
hoverBorderColorCallback
- the border color callback, as hovered
-
setHoverBorderColor
public void setHoverBorderColor(NativeCallback hoverBorderColorCallback)
Sets the border color callback, as hovered.- Parameters:
hoverBorderColorCallback
- the border color callback, as hovered
-
getHoverBorderWidthCallback
public WidthCallback<DatasetContext> getHoverBorderWidthCallback()
Returns the border width callback, if set, otherwisenull
.- Returns:
- the border width callback, if set, otherwise
null
.
-
setHoverBorderWidth
public void setHoverBorderWidth(WidthCallback<DatasetContext> hoverBorderWidthCallback)
Sets the border width callback, as hovered.- Parameters:
hoverBorderWidthCallback
- the border width callback, as hovered
-
setHoverBorderWidth
public void setHoverBorderWidth(NativeCallback hoverBorderWidthCallback)
Sets the border width callback, as hovered.- Parameters:
hoverBorderWidthCallback
- the border width callback, as hovered
-
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
-
-