Class PieLabelRecord

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable

    public class PieLabelRecord
    extends java.lang.Object
    implements java.lang.Comparable, java.io.Serializable
    A structure that retains information about the label for a section in a pie chart.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private double allocatedY
      The allocated y-coordinate.
      private double angle
      The angle of the centre of the section (in radians).
      private double baseY
      The base y-coordinate.
      private double gap
      The gap.
      private java.lang.Comparable key
      The section key.
      private TextBox label
      The label.
      private double labelHeight
      The label height.
      private double linkPercent
      The link percent.
    • Constructor Summary

      Constructors 
      Constructor Description
      PieLabelRecord​(java.lang.Comparable key, double angle, double baseY, TextBox label, double labelHeight, double gap, double linkPercent)
      Creates a new record.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compareTo​(java.lang.Object obj)
      Compares this object to an arbitrary object.
      boolean equals​(java.lang.Object obj)
      Tests this record for equality with an arbitrary object.
      double getAllocatedY()
      Returns the allocated y-coordinate.
      double getAngle()
      Returns the angle of the middle of the section, in radians.
      double getBaseY()
      Returns the base y-coordinate.
      double getGap()
      Returns the gap.
      java.lang.Comparable getKey()
      Returns the key for the section that the label applies to.
      TextBox getLabel()
      Returns the label.
      double getLabelHeight()
      Returns the label height (you could derive this from the label itself, but we cache the value so it can be retrieved quickly).
      double getLinkPercent()
      Returns the link percent.
      double getLowerY()
      Returns the lower bound of the label.
      double getUpperY()
      Returns the upper bound of the label.
      void setAllocatedY​(double y)
      Sets the allocated y-coordinate.
      void setBaseY​(double base)
      Sets the base y-coordinate.
      java.lang.String toString()
      Returns a string describing the object.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • key

        private java.lang.Comparable key
        The section key.
      • angle

        private double angle
        The angle of the centre of the section (in radians).
      • baseY

        private double baseY
        The base y-coordinate.
      • allocatedY

        private double allocatedY
        The allocated y-coordinate.
      • label

        private TextBox label
        The label.
      • labelHeight

        private double labelHeight
        The label height.
      • gap

        private double gap
        The gap.
      • linkPercent

        private double linkPercent
        The link percent.
    • Constructor Detail

      • PieLabelRecord

        public PieLabelRecord​(java.lang.Comparable key,
                              double angle,
                              double baseY,
                              TextBox label,
                              double labelHeight,
                              double gap,
                              double linkPercent)
        Creates a new record.
        Parameters:
        key - the section key.
        angle - the angle to the middle of the section (in radians).
        baseY - the base y-coordinate.
        label - the section label.
        labelHeight - the label height (in Java2D units).
        gap - the offset to the left.
        linkPercent - the link percent.
    • Method Detail

      • getBaseY

        public double getBaseY()
        Returns the base y-coordinate. This is where the label will appear if there is no overlapping of labels.
        Returns:
        The base y-coordinate.
      • setBaseY

        public void setBaseY​(double base)
        Sets the base y-coordinate.
        Parameters:
        base - the base y-coordinate.
      • getLowerY

        public double getLowerY()
        Returns the lower bound of the label.
        Returns:
        The lower bound.
      • getUpperY

        public double getUpperY()
        Returns the upper bound of the label.
        Returns:
        The upper bound.
      • getAngle

        public double getAngle()
        Returns the angle of the middle of the section, in radians.
        Returns:
        The angle, in radians.
      • getKey

        public java.lang.Comparable getKey()
        Returns the key for the section that the label applies to.
        Returns:
        The key.
      • getLabel

        public TextBox getLabel()
        Returns the label.
        Returns:
        The label.
      • getLabelHeight

        public double getLabelHeight()
        Returns the label height (you could derive this from the label itself, but we cache the value so it can be retrieved quickly).
        Returns:
        The label height (in Java2D units).
      • getAllocatedY

        public double getAllocatedY()
        Returns the allocated y-coordinate.
        Returns:
        The allocated y-coordinate.
      • setAllocatedY

        public void setAllocatedY​(double y)
        Sets the allocated y-coordinate.
        Parameters:
        y - the y-coordinate.
      • getGap

        public double getGap()
        Returns the gap.
        Returns:
        The gap.
      • getLinkPercent

        public double getLinkPercent()
        Returns the link percent.
        Returns:
        The link percent.
      • compareTo

        public int compareTo​(java.lang.Object obj)
        Compares this object to an arbitrary object.
        Specified by:
        compareTo in interface java.lang.Comparable
        Parameters:
        obj - the object to compare against.
        Returns:
        An integer that specifies the relative order of the two objects.
      • equals

        public boolean equals​(java.lang.Object obj)
        Tests this record for equality with an arbitrary object.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        obj - the object (null permitted).
        Returns:
        A boolean.
      • toString

        public java.lang.String toString()
        Returns a string describing the object. This is used for debugging only.
        Overrides:
        toString in class java.lang.Object
        Returns:
        A string.