Class CategoryLabelPositions

  • All Implemented Interfaces:
    java.io.Serializable

    public class CategoryLabelPositions
    extends java.lang.Object
    implements java.io.Serializable
    Records the label positions for a category axis. Instances of this class are immutable.
    See Also:
    Serialized Form
    • Field Detail

      • serialVersionUID

        private static final long serialVersionUID
        For serialization.
        See Also:
        Constant Field Values
      • positionForAxisAtTop

        private final CategoryLabelPosition positionForAxisAtTop
        The label positioning details used when an axis is at the top of a chart.
      • positionForAxisAtBottom

        private final CategoryLabelPosition positionForAxisAtBottom
        The label positioning details used when an axis is at the bottom of a chart.
      • positionForAxisAtLeft

        private final CategoryLabelPosition positionForAxisAtLeft
        The label positioning details used when an axis is at the left of a chart.
      • positionForAxisAtRight

        private final CategoryLabelPosition positionForAxisAtRight
        The label positioning details used when an axis is at the right of a chart.
    • Constructor Detail

      • CategoryLabelPositions

        public CategoryLabelPositions()
        Default constructor.
      • CategoryLabelPositions

        public CategoryLabelPositions​(CategoryLabelPosition top,
                                      CategoryLabelPosition bottom,
                                      CategoryLabelPosition left,
                                      CategoryLabelPosition right)
        Creates a new position specification.
        Parameters:
        top - the label position info used when an axis is at the top (null not permitted).
        bottom - the label position info used when an axis is at the bottom (null not permitted).
        left - the label position info used when an axis is at the left (null not permitted).
        right - the label position info used when an axis is at the right (null not permitted).
    • Method Detail

      • createUpRotationLabelPositions

        public static CategoryLabelPositions createUpRotationLabelPositions​(double angle)
        Creates a new instance where the category labels angled upwards by the specified amount.
        Parameters:
        angle - the rotation angle (should be < Math.PI / 2.0).
        Returns:
        A category label position specification.
      • createDownRotationLabelPositions

        public static CategoryLabelPositions createDownRotationLabelPositions​(double angle)
        Creates a new instance where the category labels angled downwards by the specified amount.
        Parameters:
        angle - the rotation angle (should be < Math.PI / 2.0).
        Returns:
        A category label position specification.
      • getLabelPosition

        public CategoryLabelPosition getLabelPosition​(RectangleEdge edge)
        Returns the category label position specification for an axis at the given location.
        Parameters:
        edge - the axis location.
        Returns:
        The category label position specification.
      • replaceTopPosition

        public static CategoryLabelPositions replaceTopPosition​(CategoryLabelPositions base,
                                                                CategoryLabelPosition top)
        Returns a new instance based on an existing instance but with the top position changed.
        Parameters:
        base - the base (null not permitted).
        top - the top position (null not permitted).
        Returns:
        A new instance (never null).
      • replaceBottomPosition

        public static CategoryLabelPositions replaceBottomPosition​(CategoryLabelPositions base,
                                                                   CategoryLabelPosition bottom)
        Returns a new instance based on an existing instance but with the bottom position changed.
        Parameters:
        base - the base (null not permitted).
        bottom - the bottom position (null not permitted).
        Returns:
        A new instance (never null).
      • replaceLeftPosition

        public static CategoryLabelPositions replaceLeftPosition​(CategoryLabelPositions base,
                                                                 CategoryLabelPosition left)
        Returns a new instance based on an existing instance but with the left position changed.
        Parameters:
        base - the base (null not permitted).
        left - the left position (null not permitted).
        Returns:
        A new instance (never null).
      • replaceRightPosition

        public static CategoryLabelPositions replaceRightPosition​(CategoryLabelPositions base,
                                                                  CategoryLabelPosition right)
        Returns a new instance based on an existing instance but with the right position changed.
        Parameters:
        base - the base (null not permitted).
        right - the right position (null not permitted).
        Returns:
        A new instance (never null).
      • equals

        public boolean equals​(java.lang.Object obj)
        Returns true if this object is equal to the specified object, and false otherwise.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        obj - the other object.
        Returns:
        A boolean.
      • hashCode

        public int hashCode()
        Returns a hash code for this object.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        A hash code.