Class Bar
-
- All Implemented Interfaces:
IsDefaultBar
,IsDefaultOptionsElement
,IsDefaultPointStyleHandler
,HasPointStyle
public class Bar extends AbstractElement<IsDefaultBar> implements IsDefaultBar, HasPointStyle
Bar elements are used to represent the bars in a bar chart.- Author:
- Andrea "Stock" Stocchero
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
Bar(Elements elements, Key childKey, IsDefaultBar defaultValues, NativeObject nativeObject)
Creates the object with the parent, the key of this element, default values and native object to map java script properties.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.int
getBorderRadius()
Returns the bar border radius (in pixels).BorderSkipped
getBorderSkipped()
Returns the edge to skip drawing the border for.int
getHoverBorderRadius()
Returns the bar border radius (in pixels) when hovered.int
getInflateAmount()
Returns the amount of pixels to inflate the bar rectangles, when drawing.PointStyleHandler
getPointStyleHandler()
Returns a point style handler instance to use in the default methods of this interface.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
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
setBorderRadius(int borderRadius)
Sets the bar border radius (in pixels).void
setBorderSkipped(boolean borderskip)
Sets the edge to skip drawing the border for.void
setBorderSkipped(BorderSkipped position)
Sets the edge to skip drawing the border for.void
setEnableBorderRadius(boolean enableBorderRadius)
Iftrue
, it only shows the borderRadius of a bar when the bar is at the end of the stack.void
setHoverBorderRadius(int borderRadius)
Sets the bar border radius (in pixels) when hovered.void
setInflateAmount(int inflateAmount)
Sets the amount of pixels to inflate the bar rectangles, when drawing.-
Methods inherited from class org.pepstock.charba.client.options.AbstractElement
getBackgroundColor, getBackgroundColorAsString, getBorderColor, getBorderColorAsString, getBorderWidth, getHoverBackgroundColor, getHoverBackgroundColorAsString, getHoverBorderColor, getHoverBorderColorAsString, getHoverBorderWidth, setBackgroundColor, setBackgroundColor, setBorderColor, setBorderColor, setBorderWidth, setHoverBackgroundColor, setHoverBackgroundColor, setHoverBorderColor, setHoverBorderColor, setHoverBorderWidth
-
Methods inherited from class org.pepstock.charba.client.options.AbstractModel
getDefaultValues, getParent, loadPadding, setCallbackToModel, setCallbackToModel, setEventToModel
-
Methods inherited from class org.pepstock.charba.client.commons.AbstractNode
checkAndAddToParent, getChildKey, getParentNode, getRootNode, getUpdateListener, retrieveRoot, setArrayValueAndAddToParent, setArrayValueAndAddToParent, setArrayValueAndAddToParent, setElementAndAddToParent, setInternalCallbackToModel, setInternalCallbackToModel, setUpdateListener, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent, setValueOrArrayAndAddToParent
-
Methods inherited from class org.pepstock.charba.client.commons.NativeObjectContainer
checkDefaultValuesArgument, empty, getArrayValue, getElement, getIncrementalId, getNativeChart, getNativeEvent, getNativeObject, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValueForMultipleKeyTypes, getValueForMultipleKeyTypes, getValueForMultipleKeyTypes, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, getValueOrArray, has, has, isType, keys, loadNativeObject, remove, remove, setArrayValue, setArrayValue, setArrayValue, setElement, setEmptyValue, setNewIncrementalId, setNewIncrementalId, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, setValueOrArray, toJSON, type
-
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.options.HasPointStyle
getPointStyle, getPointStyleAsCanvas, getPointStyleAsImage, getPointStyleType, setPointStyle, setPointStyle, setPointStyle
-
Methods inherited from interface org.pepstock.charba.client.defaults.IsDefaultOptionsElement
getBackgroundColorAsString, getBorderColorAsString, getBorderWidth, getHoverBackgroundColorAsString, getHoverBorderColorAsString, getHoverBorderWidth
-
-
-
-
Constructor Detail
-
Bar
protected Bar(Elements elements, Key childKey, IsDefaultBar defaultValues, NativeObject nativeObject)
Creates the object with the parent, the key of this element, default values and native object to map java script properties.- Parameters:
elements
- parent node to use to add this element where changedchildKey
- the property name of this element to use to add it to the parent.defaultValues
- default providernativeObject
- native object to map java script properties
-
-
Method Detail
-
getPointStyleHandler
public PointStyleHandler getPointStyleHandler()
Description copied from interface:HasPointStyle
Returns a point style handler instance to use in the default methods of this interface.- Specified by:
getPointStyleHandler
in interfaceHasPointStyle
- Returns:
- a point style handler instance
-
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.- Specified by:
isEnableBorderRadius
in interfaceIsDefaultBar
- Returns:
- if
true
, it only shows the borderRadius of a bar when the bar is at the end of the stack
-
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.- Specified by:
getBase
in interfaceIsDefaultBar
- 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 borderskip)
Sets the edge to skip drawing the border for.- Parameters:
borderskip
- to setfalse
as border skipped.
-
setBorderSkipped
public void setBorderSkipped(BorderSkipped position)
Sets the edge to skip drawing the border for.- Parameters:
position
- the edge to skip drawing the border for.
-
getBorderSkipped
public BorderSkipped getBorderSkipped()
Returns the edge to skip drawing the border for.- Specified by:
getBorderSkipped
in interfaceIsDefaultBar
- 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).- Specified by:
getBorderRadius
in interfaceIsDefaultBar
- 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.- Specified by:
getHoverBorderRadius
in interfaceIsDefaultBar
- Returns:
- the bar border radius (in pixels) when hovered.
-
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.- Specified by:
isAutoInflateAmount
in interfaceIsDefaultBar
- 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.- Specified by:
getInflateAmount
in interfaceIsDefaultBar
- Returns:
- the amount of pixels to inflate the bar rectangles, when drawing
-
-