Class CartesianAxis<T extends org.pepstock.charba.client.configuration.CartesianTick>

  • 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 Detail

      • CartesianAxis

        protected CartesianAxis​(IsChart chart,
                                ScaleId id,
                                AxisType type,
                                AxisKind kind)
        Builds the object storing the chart instance and cartesian axis type.
        Parameters:
        chart - chart instance
        id - axis id
        type - axis type
        kind - axis kind
    • 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 to true 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 to true 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.
      • 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 add
        property - 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 from org.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