Class CartesianAxis<T extends org.pepstock.charba.client.configuration.CartesianTick>
- java.lang.Object
-
- org.pepstock.charba.client.configuration.Axis
-
- org.pepstock.charba.client.configuration.CartesianAxis<T>
-
- Type Parameters:
T
- type of tick to apply to axis
- Direct Known Subclasses:
CartesianCategoryAxis
,CartesianLinearAxis
,CartesianLogarithmicAxis
,CartesianTimeAxis
public abstract class CartesianAxis<T extends org.pepstock.charba.client.configuration.CartesianTick> extends Axis
Axes are an integral part of a chart. They are used to determine how data maps to a pixel value on the chart.
In a cartesian chart, there is 1 or more X axis and 1 or more Y axis to map points onto the 2 dimensional canvas.
These axes are know as 'cartesian axes'.
Axes that follow a cartesian grid are known as 'Cartesian Axes'.
Cartesian axes are used for line, bar, and bubble charts.
Four cartesian axes are included by default.
- linear
- logarithmic
- category
- time
- Author:
- Andrea "Stock" Stocchero
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
CartesianAxis(IsChart chart, ScaleId id, AxisType type, AxisKind kind)
Builds the object storing the chart instance and cartesian axis type.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Bounds
getBounds()
Returns the property controls the scale boundary strategy (bypassed by min/max time options).BoundsCallback
getBoundsCallback()
Returns the user callback that sets the property controls the scale boundary strategy (bypassed by min/max time options).IsChart
getChart()
Returns the chart instanceprotected T
getConfiguration()
Returns the configuration element.Grid
getGrid()
Returns the grid elementScaleOffsetCallback
getOffsetCallback()
Returns the user callback that sets the added extra space to the both edges and the axis is scaled to fit in the chart area.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'.ScalePositionCallback
getPositionCallback()
Returns the user callback that sets the axis position on the chart.String
getStack()
Returns the stack group.
Axes at the same position with same stack are stacked.StackCallback
getStackCallback()
Returns the user callback that sets the stack group.StackedCallback
getStackedCallback()
Returns the user callback that sets if the axis are stacked or not.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.ScaleWeightCallback
getStackWeightCallback()
Returns the user callback that sets the weight of the scale in stack group.abstract T
getTicks()
Returns the ticks elementCartesianScaleTitle
getTitle()
Returns the scale title elementboolean
isOffset()
If true, extra space is added to the both edges and the axis is scaled to fit in the chart area.
This is set totrue
in the bar chart by default.boolean
isSingleStacked()
Returns if you might want to stack positive and negative values together.boolean
isStacked()
Gets if the axis are stacked or not.ChartEnvelop<NativeObject>
loadNativeObject(ChartEnvelop<NativeObject> envelop)
Returns the native object instance inside an envelop.
It can be called only fromorg.pepstock.charba.client
package.void
merge(NativeObjectContainer source, String property)
Merge a native object in the this one with a specific property name.
This is used by plugins implementation (native java script ones) when they are not using the standard way to add plugin configuration in the options of chart.void
setBounds(BoundsCallback boundsCallback)
Sets the user callback that sets the property controls the scale boundary strategy (bypassed by min/max time options).void
setBounds(NativeCallback boundsCallback)
Sets the user callback that sets the property controls the scale boundary strategy (bypassed by min/max time options).void
setBounds(Bounds bounds)
Sets the property controls the scale boundary strategy (bypassed by min/max time options).protected void
setConfiguration(T configuration)
void
setOffset(boolean offset)
If true, extra space is added to the both edges and the axis is scaled to fit in the chart area.
This is set totrue
in the bar chart by default.void
setOffset(NativeCallback offsetCallback)
Sets the user callback that sets the added extra space to the both edges and the axis is scaled to fit in the chart area.void
setOffset(ScaleOffsetCallback offsetCallback)
Sets the user callback that sets the added extra space to the both edges and the axis is scaled to fit in the chart area.void
setPosition(NativeCallback positionCallback)
Sets the user callback that sets the axis position on the chart.void
setPosition(ScalePositionCallback positionCallback)
Sets the user callback that sets the axis position on the chart.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'.void
setSingleStacked(boolean stacked)
Sets if you might want to stack positive and negative values together.void
setStack(String stack)
Sets the stack group.
Axes at the same position with same stack are stacked.void
setStack(NativeCallback stackCallback)
Sets the user callback that sets the stack group.void
setStack(StackCallback stackCallback)
Sets the user callback that sets the stack group.void
setStacked(boolean stacked)
Sets if the axis are stacked or not.void
setStacked(NativeCallback stackedCallback)
Sets the user callback that sets if the axis are stacked or not.void
setStacked(StackedCallback stackedCallback)
Sets the user callback that sets if the axis are stacked or not.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.void
setStackWeight(NativeCallback stackWeightCallback)
Sets the user callback that sets the weight of the scale in stack group.void
setStackWeight(ScaleWeightCallback stackWeightCallback)
Sets the user callback that sets the weight of the scale in stack group.String
toJSON()
Returns the JSON representation of the object.-
Methods inherited from class org.pepstock.charba.client.configuration.Axis
getAlignToPixelsCallback, getAxis, getAxisBuildTicksCallback, getAxisCalculateLabelRotationCallback, getAxisDataLimitsCallback, getAxisDimensionsCallback, getAxisFitCallback, getAxisTickToLabelConversionCallback, getAxisUpdateCallback, getBackgroundColor, getBackgroundColorAsString, getBackgroundColorCallback, getCharbaId, getDisplay, getDisplayCallback, getId, getReverseCallback, getType, getWeight, getWeightCallback, isAlignToPixels, isReverse, setAlignToPixels, setAlignToPixels, setAlignToPixels, setAxisBuildTicksCallback, setAxisCalculateLabelRotationCallback, setAxisDataLimitsCallback, setAxisDimensionsCallback, setAxisFitCallback, setAxisTickToLabelConversionCallback, setAxisUpdateCallback, setBackgroundColor, setBackgroundColor, setBackgroundColor, setBackgroundColor, setDisplay, setDisplay, setDisplay, setDisplay, setReverse, setReverse, setReverse, setWeight, setWeight, setWeight
-
-
-
-
Method Detail
-
getTitle
public CartesianScaleTitle getTitle()
Returns the scale title element- Returns:
- the scale title element
-
getTicks
public abstract T getTicks()
Returns the ticks element- Returns:
- the ticks
-
getGrid
public Grid getGrid()
Returns the grid element- Returns:
- the grid
-
setStacked
public void setStacked(boolean stacked)
Sets if the axis are stacked or not.- Parameters:
stacked
- if the axis are stacked or not.
-
isStacked
public boolean isStacked()
Gets if the axis are stacked or not.- Returns:
- if the axis are stacked or not.
-
setSingleStacked
public 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 boolean isSingleStacked()
Returns if you might want to stack positive and negative values together.- Returns:
- if you might want to stack positive and negative values together
-
setOffset
public void setOffset(boolean offset)
If true, extra space is added to the both edges and the axis is scaled to fit in the chart area.
This is set totrue
in the bar chart by default.- Parameters:
offset
- extra space of axis
-
isOffset
public boolean isOffset()
If true, extra space is added to the both edges and the axis is scaled to fit in the chart area.
This is set totrue
in the bar chart by default.- Returns:
- extra space of axis.
-
setPosition
public 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 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'.- Returns:
- position of axis.
-
setBounds
public 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 Bounds getBounds()
Returns the property controls the scale boundary strategy (bypassed by min/max time options).- Returns:
- property controls the scale boundary strategy (bypassed by min/max time options).
-
setStack
public 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 String getStack()
Returns the stack group.
Axes at the same position with same stack are stacked.- Returns:
- the stack group.
Axes at the same position with same stack are stacked
-
setStackWeight
public 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 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.- Returns:
- the weight of the scale in stack group.
Used to determine the amount of allocated space for the scale within the group
-
getPositionCallback
public ScalePositionCallback getPositionCallback()
Returns the user callback that sets the axis position on the chart.- Returns:
- the user callback that sets the axis position on the chart
-
setPosition
public void setPosition(ScalePositionCallback positionCallback)
Sets the user callback that sets the axis position on the chart.- Parameters:
positionCallback
- the user callback that sets the axis position on the chart
-
setPosition
public void setPosition(NativeCallback positionCallback)
Sets the user callback that sets the axis position on the chart.- Parameters:
positionCallback
- that sets the axis position on the chart
-
getOffsetCallback
public ScaleOffsetCallback getOffsetCallback()
Returns the user callback that sets the added extra space to the both edges and the axis is scaled to fit in the chart area.- Returns:
- the user callback that sets the added extra space to the both edges and the axis is scaled to fit in the chart area.
-
setOffset
public void setOffset(ScaleOffsetCallback offsetCallback)
Sets the user callback that sets the added extra space to the both edges and the axis is scaled to fit in the chart area.- Parameters:
offsetCallback
- the user callback that sets the added extra space to the both edges and the axis is scaled to fit in the chart area.
-
setOffset
public void setOffset(NativeCallback offsetCallback)
Sets the user callback that sets the added extra space to the both edges and the axis is scaled to fit in the chart area.- Parameters:
offsetCallback
- that sets the added extra space to the both edges and the axis is scaled to fit in the chart area.
-
getBoundsCallback
public BoundsCallback getBoundsCallback()
Returns the user callback that sets the property controls the scale boundary strategy (bypassed by min/max time options).- Returns:
- the user callback that sets the property controls the scale boundary strategy (bypassed by min/max time options).
-
setBounds
public void setBounds(BoundsCallback boundsCallback)
Sets the user callback that sets the property controls the scale boundary strategy (bypassed by min/max time options).- Parameters:
boundsCallback
- the user callback that sets the property controls the scale boundary strategy (bypassed by min/max time options).
-
setBounds
public void setBounds(NativeCallback boundsCallback)
Sets the user callback that sets the property controls the scale boundary strategy (bypassed by min/max time options).- Parameters:
boundsCallback
- that sets the property controls the scale boundary strategy (bypassed by min/max time options).
-
getStackedCallback
public StackedCallback getStackedCallback()
Returns the user callback that sets if the axis are stacked or not.- Returns:
- the user callback that sets if the axis are stacked or not.
-
setStacked
public void setStacked(StackedCallback stackedCallback)
Sets the user callback that sets if the axis are stacked or not.- Parameters:
stackedCallback
- the user callback that sets if the axis are stacked or not.
-
setStacked
public void setStacked(NativeCallback stackedCallback)
Sets the user callback that sets if the axis are stacked or not.- Parameters:
stackedCallback
- that sets if the axis are stacked or not.
-
getStackWeightCallback
public ScaleWeightCallback getStackWeightCallback()
Returns the user callback that sets the weight of the scale in stack group.- Returns:
- the user callback that sets the weight of the scale in stack group.
-
setStackWeight
public void setStackWeight(ScaleWeightCallback stackWeightCallback)
Sets the user callback that sets the weight of the scale in stack group.- Parameters:
stackWeightCallback
- the user callback that sets the weight of the scale in stack group.
-
setStackWeight
public void setStackWeight(NativeCallback stackWeightCallback)
Sets the user callback that sets the weight of the scale in stack group.- Parameters:
stackWeightCallback
- that sets the weight of the scale in stack group.
-
getStackCallback
public StackCallback getStackCallback()
Returns the user callback that sets the stack group.- Returns:
- the user callback that sets the stack group
-
setStack
public void setStack(StackCallback stackCallback)
Sets the user callback that sets the stack group.- Parameters:
stackCallback
- the user callback that sets the stack group
-
setStack
public void setStack(NativeCallback stackCallback)
Sets the user callback that sets the stack group.- Parameters:
stackCallback
- that sets the stack group
-
setConfiguration
protected final void setConfiguration(T configuration)
- Parameters:
configuration
- the configuration to set
-
getConfiguration
protected final T getConfiguration()
Returns the configuration element.- Returns:
- the configuration element.
-
merge
public final void merge(NativeObjectContainer source, String property)
Merge a native object in the this one with a specific property name.
This is used by plugins implementation (native java script ones) when they are not using the standard way to add plugin configuration in the options of chart.- Parameters:
source
- native object container to addproperty
- property name
-
toJSON
public final String toJSON()
Returns the JSON representation of the object.- Returns:
- the JSON representation of the object.
-
loadNativeObject
public final ChartEnvelop<NativeObject> loadNativeObject(ChartEnvelop<NativeObject> envelop)
Returns the native object instance inside an envelop.
It can be called only fromorg.pepstock.charba.client
package.- Parameters:
envelop
- envelop instance which will contain the native object- Returns:
- the envelop, passed as argument, loaded with the native object
-
getChart
public final IsChart getChart()
Returns the chart instance- Returns:
- the chart
-
-