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.
Five cartesian axes are included by default.
- linear
- logarithmic
- category
- time
- timeseries
- Author:
- Andrea "Stock" Stocchero
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedCartesianAxis(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 AxisBordergetBorder()Returns the border element.BoundsgetBounds()Returns the property controls the scale boundary strategy (bypassed by min/max time options).BoundsCallbackgetBoundsCallback()Returns the user callback that sets the property controls the scale boundary strategy (bypassed by min/max time options).IsChartgetChart()Returns the chart instanceprotected TgetConfiguration()Returns the configuration element.GridgetGrid()Returns the grid elementScaleOffsetCallbackgetOffsetCallback()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.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'.AxisPositionItemgetPositionAsItem()Returns the position of the axis at a specific value of another axis.ScalePositionCallbackgetPositionCallback()Returns the user callback that sets the axis position on the chart.StringgetStack()Returns the stack group.
Axes at the same position with same stack are stacked.StackCallbackgetStackCallback()Returns the user callback that sets the stack group.StackedCallbackgetStackedCallback()Returns the user callback that sets if the axis are stacked or not.doublegetStackWeight()Returns the weight of the scale in stack group.
Used to determine the amount of allocated space for the scale within the group.ScaleWeightCallbackgetStackWeightCallback()Returns the user callback that sets the weight of the scale in stack group.abstract TgetTicks()Returns the ticks elementCartesianScaleTitlegetTitle()Returns the scale title elementbooleanisOffset()If true, extra space is added to the both edges and the axis is scaled to fit in the chart area.
This is set totruein the bar chart by default.booleanisSingleStacked()Returns if you might want to stack positive and negative values together.booleanisStacked()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.clientpackage.voidmerge(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.voidsetBounds(BoundsCallback boundsCallback)Sets the user callback that sets the property controls the scale boundary strategy (bypassed by min/max time options).voidsetBounds(NativeCallback boundsCallback)Sets the user callback that sets the property controls the scale boundary strategy (bypassed by min/max time options).voidsetBounds(Bounds bounds)Sets the property controls the scale boundary strategy (bypassed by min/max time options).protected voidsetConfiguration(T configuration)voidsetOffset(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 totruein the bar chart by default.voidsetOffset(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.voidsetOffset(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.voidsetPosition(NativeCallback positionCallback)Sets the user callback that sets the axis position on the chart.voidsetPosition(ScalePositionCallback positionCallback)Sets the user callback that sets the axis position on the chart.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'.voidsetPosition(AxisPositionItem position)Sets the position of the axis at a specific value of another axis.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.voidsetStack(NativeCallback stackCallback)Sets the user callback that sets the stack group.voidsetStack(StackCallback stackCallback)Sets the user callback that sets the stack group.voidsetStacked(boolean stacked)Sets if the axis are stacked or not.voidsetStacked(NativeCallback stackedCallback)Sets the user callback that sets if the axis are stacked or not.voidsetStacked(StackedCallback stackedCallback)Sets the user callback that 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.voidsetStackWeight(NativeCallback stackWeightCallback)Sets the user callback that sets the weight of the scale in stack group.voidsetStackWeight(ScaleWeightCallback stackWeightCallback)Sets the user callback that sets the weight of the scale in stack group.StringtoJSON()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, getScaleItem, 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
-
getBorder
public AxisBorder getBorder()
Returns the border element.- Returns:
- the border
-
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 totruein 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 totruein 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.
-
setPosition
public void setPosition(AxisPositionItem position)
Sets the position of the axis at a specific value of another axis.- Parameters:
position- position of axis
-
getPositionAsItem
public AxisPositionItem getPositionAsItem()
Returns the position of the axis at a specific value of another axis.- 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.clientpackage.- 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
-
-