Class AbstractScale
- java.lang.Object
-
- org.pepstock.charba.client.commons.NativeObjectContainer
-
- org.pepstock.charba.client.commons.AbstractNode
-
- org.pepstock.charba.client.options.AbstractModel<Options,IsDefaultScale>
-
- org.pepstock.charba.client.options.AbstractScale
-
- All Implemented Interfaces:
HasLabels,IsDefaultScale
- Direct Known Subclasses:
GlobalScale,Scale
public abstract class AbstractScale extends AbstractModel<Options,IsDefaultScale> implements IsDefaultScale, HasLabels
Scales are an integral part of a chart.
They are used to determine how data maps to a pixel value on the chart.
- linear
- logarithmic
- category
- time
- time series
- radial linear
- Author:
- Andrea "Stock" Stocchero
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractScale(IsDefaultScale defaultValues, NativeObject nativeObject)Creates the object only with default provider and native object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AdaptersgetAdapters()Returns the adapters element.AngleLinesgetAngleLines()Returns the angle lines element.IsColorgetBackgroundColor()Returns the background color of the scale area.StringgetBackgroundColorAsString()Returns the background color of the scale area.BoundsgetBounds()Returns the property controls the scale boundary strategy (bypassed by min/max time options).DisplaygetDisplay()The display option controls the visibility of axis.
Controls the axis global visibility (visible when true, hidden when false).intgetGrace()Returns the value in pixels is added to the maximum data value and subtracted from the minimum data.
This extends the scale range as if the data values were that much greater.doublegetGraceAsPercentage()Returns the value in percentage, value between 0 and 1, is added to the maximum data value and subtracted from the minimum data.
This extends the scale range as if the data values were that much greater.GridgetGrid()Returns the grid element.LabelsHandlergetLabelsHandler()Returns an labels option handler instance.doublegetMax()Returns the user defined maximum number for the scale, overrides maximum value from data.DategetMaxAsDate()If defined, this will override the data maximum.StringgetMaxAsString()Returns the user defined maximum number for the scale, overrides maximum value from data.intgetMaxIndex()Returns the maximum item at passed index to display.doublegetMin()Returns the user defined minimum number for the scale, overrides minimum value from data.DategetMinAsDate()If defined, this will override the data minimum.StringgetMinAsString()Returns the user defined minimum number for the scale, overrides minimum value from data.intgetMinIndex()Returns the minimum item at passed index to displayPointLabelsgetPointLabels()Returns the point labels element.AxisPositiongetPosition()An axis can either be positioned at the edge of the chart, at the center of the chart area, or dynamically with respect to a data value.
To position the axis at the edge of the chart, set the position option to one of: 'top', 'left', 'bottom', 'right'.
To position the axis at the center of the chart area, set the position option to 'center'.StringgetStack()Returns the stack group.
Axes at the same position with same stack are stacked.doublegetStackWeight()Returns the weight of the scale in stack group.
Used to determine the amount of allocated space for the scale within the group.doublegetStartAngle()Returns the starting angle to draw arcs for the first item in a data set.doublegetSuggestedMax()Returns the adjustment used when calculating the maximum data value.doublegetSuggestedMin()Returns the adjustment used when calculating the minimum data value.TicksgetTicks()Returns the ticks element.TimegetTime()Returns the time element.ScaleTitlegetTitle()Returns the scale title element.doublegetWeight()The weight used to sort the axis.booleanisAlignToPixels()Returnstrueto align pixel values to device pixels.booleanisAnimate()Returns whether to animate scaling the chart from the center.booleanisBeginAtZero()Iftrue, scale will include 0 if it is not already included.booleanisOffset()Iftrue, extra space is added to the both edges and the axis is scaled to fit in the chart area.booleanisOffsetAfterAutoskip()Iftrue, bar chart offsets are computed with auto skipped ticks..booleanisReverse()Returns the reversed order of tick labels.booleanisSingleStacked()Returns if you might want to stack positive and negative values together.booleanisStacked()Returns if the axis are stacked or not.voidsetAlignToPixels(boolean alignToPixels)Setstrueto align pixel values to device pixels.voidsetAnimate(boolean animate)Sets whether to animate scaling the chart from the center.voidsetBackgroundColor(String backgroundColor)Sets the background color of the scale area.voidsetBackgroundColor(IsColor backgroundColor)Sets the default background color to use in the chart, on all objects, if not override by the specific configuration.voidsetBeginAtZero(boolean beginAtZero)Iftrue, scale will include 0 if it is not already included.voidsetBounds(Bounds bounds)Sets the property controls the scale boundary strategy (bypassed by min/max time options).voidsetDisplay(boolean display)Iftrue, shows the axis.voidsetDisplay(Display display)The display option controls the visibility of axis.
Controls the axis global visibility (visible when true, hidden when false).voidsetGrace(int grace)Sets the value in pixels is added to the maximum data value and subtracted from the minimum data.
This extends the scale range as if the data values were that much greater.voidsetGraceAsPercentage(double grace)Sets the value in percentage, value between 0 and 1, is added to the maximum data value and subtracted from the minimum data.
This extends the scale range as if the data values were that much greater.voidsetLabels(String... labels)Sets the labels of the data.voidsetLabels(Labels labels)Sets the labels of the data.voidsetMax(double max)Sets the user defined maximum number for the scale, overrides maximum value from data.voidsetMax(String max)Sets the user defined maximum number for the scale, overrides maximum value from data.voidsetMax(Date max)If defined, this will override the data maximum.voidsetMaxIndex(int max)Sets the maximum item at passed index to display.voidsetMin(double min)Sets the user defined minimum number for the scale, overrides minimum value from data.voidsetMin(String min)Sets the user defined minimum number for the scale, overrides minimum value from data.voidsetMin(Date min)If defined, this will override the data minimum.voidsetMinIndex(int min)Sets the minimum item at passed index to display.voidsetOffset(boolean offset)Iftrue, extra space is added to the both edges and the axis is scaled to fit in the chart area.voidsetOffsetAfterAutoskip(boolean offsetAfterAutoskip)Iftrue, bar chart offsets are computed with auto skipped ticks..voidsetPosition(AxisPosition position)An axis can either be positioned at the edge of the chart, at the center of the chart area, or dynamically with respect to a data value.
To position the axis at the edge of the chart, set the position option to one of: 'top', 'left', 'bottom', 'right'.
To position the axis at the center of the chart area, set the position option to 'center'.voidsetReverse(boolean reverse)Sets the reversed order of tick labels.voidsetSingleStacked(boolean stacked)Sets if you might want to stack positive and negative values together.voidsetStack(String stack)Sets the stack group.
Axes at the same position with same stack are stacked.voidsetStacked(boolean stacked)Sets if the axis are stacked or not.voidsetStackWeight(double stackWeight)Sets the weight of the scale in stack group.
Used to determine the amount of allocated space for the scale within the group.voidsetStartAngle(double startAngle)Sets the starting angle to draw arcs for the first item in a data set.voidsetSuggestedMax(double suggestedMax)Sets the adjustment used when calculating the maximum data value.voidsetSuggestedMin(double suggestedMin)Sets the adjustment used when calculating the minimum data value.voidsetWeight(double weight)The weight used to sort the axis.-
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, retrieveRoot, setArrayValueAndAddToParent, setArrayValueAndAddToParent, setArrayValueAndAddToParent, setElementAndAddToParent, setInternalCallbackToModel, setInternalCallbackToModel, 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, 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
-
-
-
-
Constructor Detail
-
AbstractScale
protected AbstractScale(IsDefaultScale defaultValues, NativeObject nativeObject)
Creates the object only with default provider and native object. This is used when the scale is the root element.- Parameters:
defaultValues- default provider instance.nativeObject- native object to store properties.
-
-
Method Detail
-
getLabelsHandler
public final LabelsHandler getLabelsHandler()
Description copied from interface:HasLabelsReturns an labels option handler instance.- Specified by:
getLabelsHandlerin interfaceHasLabels- Returns:
- an labels option handler instance
-
getTitle
public final ScaleTitle getTitle()
Returns the scale title element.- Specified by:
getTitlein interfaceIsDefaultScale- Returns:
- the scale title element
-
getTicks
public final Ticks getTicks()
Returns the ticks element.- Specified by:
getTicksin interfaceIsDefaultScale- Returns:
- the ticks
-
getGrid
public final Grid getGrid()
Returns the grid element.- Specified by:
getGridin interfaceIsDefaultScale- Returns:
- the grid
-
getAngleLines
public final AngleLines getAngleLines()
Returns the angle lines element.- Specified by:
getAngleLinesin interfaceIsDefaultScale- Returns:
- the angleLines
-
getPointLabels
public final PointLabels getPointLabels()
Returns the point labels element.- Specified by:
getPointLabelsin interfaceIsDefaultScale- Returns:
- the pointLabels
-
getTime
public final Time getTime()
Returns the time element.- Specified by:
getTimein interfaceIsDefaultScale- Returns:
- the time
-
getAdapters
public final Adapters getAdapters()
Returns the adapters element.- Specified by:
getAdaptersin interfaceIsDefaultScale- Returns:
- the adapters
-
setBeginAtZero
public final void setBeginAtZero(boolean beginAtZero)
Iftrue, scale will include 0 if it is not already included.- Parameters:
beginAtZero- iftrue, scale will include 0 if it is not already included.
-
isBeginAtZero
public final boolean isBeginAtZero()
Iftrue, scale will include 0 if it is not already included.- Specified by:
isBeginAtZeroin interfaceIsDefaultScale- Returns:
- if
true, scale will include 0 if it is not already included.
-
setBackgroundColor
public void setBackgroundColor(IsColor backgroundColor)
Sets the default background color to use in the chart, on all objects, if not override by the specific configuration.- Parameters:
backgroundColor- background color to use in the chart.
-
setBackgroundColor
public void setBackgroundColor(String backgroundColor)
Sets the background color of the scale area.- Parameters:
backgroundColor- the background color of the scale area.
-
getBackgroundColorAsString
public String getBackgroundColorAsString()
Returns the background color of the scale area.- Specified by:
getBackgroundColorAsStringin interfaceIsDefaultScale- Returns:
- the background color of the scale area.
-
getBackgroundColor
public IsColor getBackgroundColor()
Returns the background color of the scale area.- Returns:
- the background color of the scale area.
-
setGrace
public final void setGrace(int grace)
Sets the value in pixels is added to the maximum data value and subtracted from the minimum data.
This extends the scale range as if the data values were that much greater.- Parameters:
grace- the value in pixels is added to the maximum data value and subtracted from the minimum data
-
getGrace
public final int getGrace()
Returns the value in pixels is added to the maximum data value and subtracted from the minimum data.
This extends the scale range as if the data values were that much greater.- Specified by:
getGracein interfaceIsDefaultScale- Returns:
- the value in pixels is added to the maximum data value and subtracted from the minimum data
-
setGraceAsPercentage
public final void setGraceAsPercentage(double grace)
Sets the value in percentage, value between 0 and 1, is added to the maximum data value and subtracted from the minimum data.
This extends the scale range as if the data values were that much greater.- Parameters:
grace- the value in percentage is added to the maximum data value and subtracted from the minimum data
-
getGraceAsPercentage
public final double getGraceAsPercentage()
Returns the value in percentage, value between 0 and 1, is added to the maximum data value and subtracted from the minimum data.
This extends the scale range as if the data values were that much greater.- Specified by:
getGraceAsPercentagein interfaceIsDefaultScale- Returns:
- the value in percentage is added to the maximum data value and subtracted from the minimum data
-
setMin
public final void setMin(double min)
Sets the user defined minimum number for the scale, overrides minimum value from data.- Parameters:
min- the user defined minimum number for the scale, overrides minimum value from data.
-
getMin
public final double getMin()
Returns the user defined minimum number for the scale, overrides minimum value from data.- Specified by:
getMinin interfaceIsDefaultScale- Returns:
- the user defined minimum number for the scale, overrides minimum value from data.
-
setMin
public final void setMin(Date min)
If defined, this will override the data minimum.- Parameters:
min- If defined, this will override the data minimum.
-
getMinAsDate
public final Date getMinAsDate()
If defined, this will override the data minimum.- Returns:
- If defined, this will override the data minimum.
-
setMax
public final void setMax(double max)
Sets the user defined maximum number for the scale, overrides maximum value from data.- Parameters:
max- user defined maximum number for the scale, overrides maximum value from data.
-
getMax
public final double getMax()
Returns the user defined maximum number for the scale, overrides maximum value from data.- Specified by:
getMaxin interfaceIsDefaultScale- Returns:
- user defined maximum number for the scale, overrides maximum value from data.
-
setMax
public final void setMax(Date max)
If defined, this will override the data maximum.- Parameters:
max- if defined, this will override the data maximum.
-
getMaxAsDate
public final Date getMaxAsDate()
If defined, this will override the data maximum.- Returns:
- if defined, this will override the data maximum.
-
setMin
public final void setMin(String min)
Sets the user defined minimum number for the scale, overrides minimum value from data.- Parameters:
min- the user defined minimum number for the scale, overrides minimum value from data.
-
getMinAsString
public final String getMinAsString()
Returns the user defined minimum number for the scale, overrides minimum value from data.- Returns:
- the user defined minimum number for the scale, overrides minimum value from data.
-
setMax
public final void setMax(String max)
Sets the user defined maximum number for the scale, overrides maximum value from data.- Parameters:
max- user defined maximum number for the scale, overrides maximum value from data.
-
getMaxAsString
public final String getMaxAsString()
Returns the user defined maximum number for the scale, overrides maximum value from data.- Returns:
- user defined maximum number for the scale, overrides maximum value from data.
-
setMinIndex
public final void setMinIndex(int min)
Sets the minimum item at passed index to display.- Parameters:
min- The minimum item at passed index to display
-
getMinIndex
public final int getMinIndex()
Returns the minimum item at passed index to display- Returns:
- The minimum item at passed index to display
-
setMaxIndex
public final void setMaxIndex(int max)
Sets the maximum item at passed index to display.- Parameters:
max- the maximum item at passed index to display.
-
getMaxIndex
public final int getMaxIndex()
Returns the maximum item at passed index to display.- Returns:
- the maximum item at passed index to display.
-
setSuggestedMax
public final void setSuggestedMax(double suggestedMax)
Sets the adjustment used when calculating the maximum data value.- Parameters:
suggestedMax- adjustment used when calculating the maximum data value.
-
getSuggestedMax
public final double getSuggestedMax()
Returns the adjustment used when calculating the maximum data value.- Specified by:
getSuggestedMaxin interfaceIsDefaultScale- Returns:
- adjustment used when calculating the maximum data value.
-
setSuggestedMin
public final void setSuggestedMin(double suggestedMin)
Sets the adjustment used when calculating the minimum data value.- Parameters:
suggestedMin- adjustment used when calculating the minimum data value.
-
getSuggestedMin
public final double getSuggestedMin()
Returns the adjustment used when calculating the minimum data value.- Specified by:
getSuggestedMinin interfaceIsDefaultScale- Returns:
- adjustment used when calculating the minimum data value.
-
setAlignToPixels
public final void setAlignToPixels(boolean alignToPixels)
Setstrueto align pixel values to device pixels.- Parameters:
alignToPixels-trueto align pixel values to device pixels.
-
isAlignToPixels
public final boolean isAlignToPixels()
Returnstrueto align pixel values to device pixels.- Specified by:
isAlignToPixelsin interfaceIsDefaultScale- Returns:
trueto align pixel values to device pixels
-
setReverse
public final void setReverse(boolean reverse)
Sets the reversed order of tick labels.- Parameters:
reverse- reversed order of tick labels.
-
isReverse
public final boolean isReverse()
Returns the reversed order of tick labels.- Specified by:
isReversein interfaceIsDefaultScale- Returns:
- if
truereversed order of tick labels.
-
setStacked
public final void setStacked(boolean stacked)
Sets if the axis are stacked or not.- Parameters:
stacked- if the axis are stacked or not.
-
isStacked
public final boolean isStacked()
Returns if the axis are stacked or not.- Specified by:
isStackedin interfaceIsDefaultScale- Returns:
- if the axis are stacked or not.
-
setSingleStacked
public final void setSingleStacked(boolean stacked)
Sets if you might want to stack positive and negative values together.- Parameters:
stacked- if you might want to stack positive and negative values together
-
isSingleStacked
public final boolean isSingleStacked()
Returns if you might want to stack positive and negative values together.- Specified by:
isSingleStackedin interfaceIsDefaultScale- Returns:
- if you might want to stack positive and negative values together
-
setWeight
public final void setWeight(double weight)
The weight used to sort the axis. Higher weights are further away from the chart area.- Parameters:
weight- weight of axis
-
getWeight
public final double getWeight()
The weight used to sort the axis. Higher weights are further away from the chart area.- Specified by:
getWeightin interfaceIsDefaultScale- Returns:
- weight of axis.
-
setDisplay
public final void setDisplay(boolean display)
Iftrue, shows the axis.- Parameters:
display- iftrue, shows the axes.
-
setDisplay
public final void setDisplay(Display display)
The display option controls the visibility of axis.
Controls the axis global visibility (visible when true, hidden when false). When display: 'auto', the axis is visible only if at least one associated dataset is visible.- Parameters:
display- display option controls the visibility of axis
-
getDisplay
public final Display getDisplay()
The display option controls the visibility of axis.
Controls the axis global visibility (visible when true, hidden when false). When display: 'auto', the axis is visible only if at least one associated dataset is visible.- Specified by:
getDisplayin interfaceIsDefaultScale- Returns:
- display option controls the visibility of axis
-
setOffset
public final void setOffset(boolean offset)
Iftrue, extra space is added to the both edges and the axis is scaled to fit in the chart area.- Parameters:
offset- extra space of axis
-
isOffset
public final boolean isOffset()
Iftrue, extra space is added to the both edges and the axis is scaled to fit in the chart area.- Specified by:
isOffsetin interfaceIsDefaultScale- Returns:
- extra space of axis.
-
setPosition
public final void setPosition(AxisPosition position)
An axis can either be positioned at the edge of the chart, at the center of the chart area, or dynamically with respect to a data value.
To position the axis at the edge of the chart, set the position option to one of: 'top', 'left', 'bottom', 'right'.
To position the axis at the center of the chart area, set the position option to 'center'.- Parameters:
position- position of axis
-
getPosition
public final AxisPosition getPosition()
An axis can either be positioned at the edge of the chart, at the center of the chart area, or dynamically with respect to a data value.
To position the axis at the edge of the chart, set the position option to one of: 'top', 'left', 'bottom', 'right'.
To position the axis at the center of the chart area, set the position option to 'center'.- Specified by:
getPositionin interfaceIsDefaultScale- Returns:
- position of axis.
-
setBounds
public final void setBounds(Bounds bounds)
Sets the property controls the scale boundary strategy (bypassed by min/max time options).- Parameters:
bounds- property controls the scale boundary strategy (bypassed by min/max time options).
-
getBounds
public final Bounds getBounds()
Returns the property controls the scale boundary strategy (bypassed by min/max time options).- Specified by:
getBoundsin interfaceIsDefaultScale- Returns:
- property controls the scale boundary strategy (bypassed by min/max time options).
-
setStack
public final void setStack(String stack)
Sets the stack group.
Axes at the same position with same stack are stacked.- Parameters:
stack- the stack group.
Axes at the same position with same stack are stacked
-
getStack
public final String getStack()
Returns the stack group.
Axes at the same position with same stack are stacked.- Specified by:
getStackin interfaceIsDefaultScale- Returns:
- the stack group.
Axes at the same position with same stack are stacked
-
setStackWeight
public final void setStackWeight(double stackWeight)
Sets the weight of the scale in stack group.
Used to determine the amount of allocated space for the scale within the group.- Parameters:
stackWeight- the weight of the scale in stack group.
Used to determine the amount of allocated space for the scale within the group.
-
getStackWeight
public final double getStackWeight()
Returns the weight of the scale in stack group.
Used to determine the amount of allocated space for the scale within the group.- Specified by:
getStackWeightin interfaceIsDefaultScale- Returns:
- the weight of the scale in stack group.
Used to determine the amount of allocated space for the scale within the group
-
setLabels
public final void setLabels(String... labels)
Sets the labels of the data.
-
setLabels
public final void setLabels(Labels labels)
Sets the labels of the data.
-
setAnimate
public final void setAnimate(boolean animate)
Sets whether to animate scaling the chart from the center.- Parameters:
animate- whether to animate scaling the chart from the center.
-
isAnimate
public final boolean isAnimate()
Returns whether to animate scaling the chart from the center.- Specified by:
isAnimatein interfaceIsDefaultScale- Returns:
- whether to animate scaling the chart from the center.
-
setStartAngle
public void setStartAngle(double startAngle)
Sets the starting angle to draw arcs for the first item in a data set.- Parameters:
startAngle- starting angle to draw arcs for the first item in a data set.
-
getStartAngle
public double getStartAngle()
Returns the starting angle to draw arcs for the first item in a data set.- Specified by:
getStartAnglein interfaceIsDefaultScale- Returns:
- starting angle to draw arcs for the first item in a data set.
-
setOffsetAfterAutoskip
public final void setOffsetAfterAutoskip(boolean offsetAfterAutoskip)
Iftrue, bar chart offsets are computed with auto skipped ticks..- Parameters:
offsetAfterAutoskip- iftrue, bar chart offsets are computed with auto skipped ticks..
-
isOffsetAfterAutoskip
public final boolean isOffsetAfterAutoskip()
Iftrue, bar chart offsets are computed with auto skipped ticks..- Specified by:
isOffsetAfterAutoskipin interfaceIsDefaultScale- Returns:
- if
true, bar chart offsets are computed with auto skipped ticks..
-
-