Class PieLabelDistributor

java.lang.Object
org.jfree.chart.plot.AbstractPieLabelDistributor
org.jfree.chart.plot.PieLabelDistributor
All Implemented Interfaces:
Serializable

public class PieLabelDistributor extends AbstractPieLabelDistributor
This class distributes the section labels for one side of a pie chart so that they do not overlap.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private double
    The minimum gap.

    Fields inherited from class org.jfree.chart.plot.AbstractPieLabelDistributor

    labels
  • Constructor Summary

    Constructors
    Constructor
    Description
    PieLabelDistributor(int labelCount)
    Creates a new distributor.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    adjustDownwards(double minY, double height)
    Any labels that are overlapping are moved down in an attempt to eliminate the overlaps.
    protected void
    Adjusts the y-coordinate for the labels in towards the center in an attempt to fix overlapping.
    protected void
    adjustUpwards(double minY, double height)
    Any labels that are overlapping are moved up in an attempt to eliminate the overlaps.
    void
    distributeLabels(double minY, double height)
    Distributes the labels.
    private boolean
    Returns true if there are overlapping labels in the list, and false otherwise.
    void
    Sorts the label records into ascending order by y-value.
    protected void
    spreadEvenly(double minY, double height)
    Labels are spaced evenly in the available space in an attempt to eliminate the overlaps.
    Returns a string containing a description of the object for debugging purposes.

    Methods inherited from class org.jfree.chart.plot.AbstractPieLabelDistributor

    addPieLabelRecord, clear, getItemCount, getPieLabelRecord

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • minGap

      private double minGap
      The minimum gap.
  • Constructor Details

    • PieLabelDistributor

      public PieLabelDistributor(int labelCount)
      Creates a new distributor.
      Parameters:
      labelCount - the number of labels (ignored).
  • Method Details

    • distributeLabels

      public void distributeLabels(double minY, double height)
      Distributes the labels.
      Specified by:
      distributeLabels in class AbstractPieLabelDistributor
      Parameters:
      minY - the minimum y-coordinate in Java2D-space.
      height - the available height (in Java2D units).
    • isOverlap

      private boolean isOverlap()
      Returns true if there are overlapping labels in the list, and false otherwise.
      Returns:
      A boolean.
    • adjustInwards

      protected void adjustInwards()
      Adjusts the y-coordinate for the labels in towards the center in an attempt to fix overlapping.
    • adjustDownwards

      protected void adjustDownwards(double minY, double height)
      Any labels that are overlapping are moved down in an attempt to eliminate the overlaps.
      Parameters:
      minY - the minimum y value (in Java2D coordinate space).
      height - the height available for all labels.
    • adjustUpwards

      protected void adjustUpwards(double minY, double height)
      Any labels that are overlapping are moved up in an attempt to eliminate the overlaps.
      Parameters:
      minY - the minimum y value (in Java2D coordinate space).
      height - the height available for all labels.
    • spreadEvenly

      protected void spreadEvenly(double minY, double height)
      Labels are spaced evenly in the available space in an attempt to eliminate the overlaps.
      Parameters:
      minY - the minimum y value (in Java2D coordinate space).
      height - the height available for all labels.
    • sort

      public void sort()
      Sorts the label records into ascending order by y-value.
    • toString

      public String toString()
      Returns a string containing a description of the object for debugging purposes.
      Overrides:
      toString in class Object
      Returns:
      A string.