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 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 BoundsgetBounds()Returns 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 elementAxisPositiongetPosition()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.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(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.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'.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.StringtoJSON()Returns the JSON representation of the object.-
Methods inherited from class org.pepstock.charba.client.configuration.Axis
getAxis, getAxisBuildTicksCallback, getAxisCalculateLabelRotationCallback, getAxisDataLimitsCallback, getAxisDimensionsCallback, getAxisFitCallback, getAxisTickToLabelConversionCallback, getAxisUpdateCallback, getBackgroundColor, getBackgroundColorAsString, getCharbaId, getDisplay, getId, getType, getWeight, isAlignToPixels, isReverse, setAlignToPixels, setAxisBuildTicksCallback, setAxisCalculateLabelRotationCallback, setAxisDataLimitsCallback, setAxisDimensionsCallback, setAxisFitCallback, setAxisTickToLabelConversionCallback, setAxisUpdateCallback, setBackgroundColor, setBackgroundColor, setDisplay, setDisplay, setReverse, 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 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.
-
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
-
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
-
-