com.orsoncharts.plot

## Class PiePlot3D

- java.lang.Object
- - com.orsoncharts.plot.AbstractPlot3D
  - - com.orsoncharts.plot.PiePlot3D

- All Implemented Interfaces:
    ChartElement, Dataset3DChangeListener, Plot3D, java.io.Serializable, java.util.EventListener

      public class PiePlot3D
      extends AbstractPlot3D
      implements java.io.Serializable

  A plot for creating 3D pie charts. To create a pie chart, you can use the `createPieChart()` method in the `Chart3DFactory` class. A typical pie chart will look like this:
  NOTE: This class is serializable, but the serialization format is subject to change in future releases and should not be relied upon for persisting instances of this class.
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.awt.Font` | `DEFAULT_SECTION_LABEL_FONT` The default font for section labels on the chart.

    - ### Fields inherited from class com.orsoncharts.plot.AbstractPlot3D

      `autoAdjustDimensions, dimensions`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PiePlot3D(PieDataset3D dataset)` Creates a new pie plot in 3D.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `compose(World world, double xOffset, double yOffset, double zOffset)` Adds 3D objects representing the current data for the plot to the specified world.
    `boolean` | `equals(java.lang.Object obj)` Tests this plot for equality with an arbitrary object.
    `java.lang.String` | `generateToolTipText(ItemKey itemKey)` Returns the tool tip text for the specified data item, or `null` if no tool tip is required.
    `PieDataset3D` | `getDataset()` Returns the dataset.
    `double` | `getDepth()` Returns the depth of the pie (the default value is 2.0).
    `Dimension3D` | `getDimensions()` Returns the dimensions for the plot.
    `java.util.List<Object3D>` | `getLabelFaces(double xOffset, double yOffset, double zOffset)` Returns a list of label faces for the plot.
    `java.util.List<LegendItemInfo>` | `getLegendInfo()` Returns a list containing legend item info, typically one item for each series in the chart.
    `PieLabelGenerator` | `getLegendLabelGenerator()` Returns the object that creates legend labels for each section of the pie chart.
    `double` | `getRadius()` Returns the radius of the pie (the default value is 8.0).
    `ColorSource` | `getSectionColorSource()` Returns the color source for section colors.
    `ColorSource` | `getSectionLabelColorSource()` Returns the color source for section labels.
    `FontSource` | `getSectionLabelFontSource()` Returns the font source that is used to determine the font to use for the section labels.
    `PieLabelGenerator` | `getSectionLabelGenerator()` Returns the object that creates labels for each section of the pie chart.
    `int` | `getSegmentCount()` Returns the number of segments used when composing the 3D objects representing the pie chart.
    `PieLabelGenerator` | `getToolTipGenerator()` Returns the tool tip generator.
    `int` | `hashCode()`
    `void` | `receive(ChartElementVisitor visitor)` Receives a visitor.
    `void` | `setDataset(PieDataset3D dataset)` Sets the dataset and notifies registered listeners that the dataset has been updated.
    `void` | `setDepth(double depth)` Sets the depth of the pie chart and sends a change event to all registered listeners.
    `void` | `setLegendLabelGenerator(PieLabelGenerator generator)` Sets the object that creates legend labels for each section of the pie chart, and sends a `Plot3DChangeEvent` to all registered listeners.
    `void` | `setRadius(double radius)` Sets the radius of the pie chart and sends a change event to all registered listeners.
    `void` | `setSectionColors(java.awt.Color... colors)` Sets a new color source for the plot using the specified colors and sends a `Plot3DChangeEvent` to all registered listeners.
    `void` | `setSectionColorSource(ColorSource source)` Sets the color source and sends a `Plot3DChangeEvent` to all registered listeners.
    `void` | `setSectionLabelColorSource(ColorSource source)` Sets the color source for the section labels and sends a `Plot3DChangeEvent` to all registered listeners.
    `void` | `setSectionLabelFontSource(FontSource source)` Sets the font source and sends a `Plot3DChangeEvent` to all registered listeners.
    `void` | `setSectionLabelGenerator(PieLabelGenerator generator)` Sets the object that creates labels for each section of the pie chart, and sends a `Plot3DChangeEvent` to all registered listeners.
    `void` | `setSegmentCount(int count)` Sets the number of segments used when composing the pie chart and sends a `Plot3DChangeEvent` to all registered listeners.
    `void` | `setToolTipGenerator(PieLabelGenerator generator)` Sets the tool tip generator and sends a change event to all registered listeners.

    - ### Methods inherited from class com.orsoncharts.plot.AbstractPlot3D

      `addChangeListener, datasetChanged, fireChangeEvent, getChart, isAutoAdjustDimensions, isNotify, notifyListeners, removeChangeListener, setChart, setNotify`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### DEFAULT_SECTION_LABEL_FONT

          public static final java.awt.Font DEFAULT_SECTION_LABEL_FONT

      The default font for section labels on the chart.

  - ### Constructor Detail

    - #### PiePlot3D

          public PiePlot3D(PieDataset3D dataset)

      Creates a new pie plot in 3D.
      Parameters:
        `dataset` - the dataset (`null` not permitted).

  - ### Method Detail

    - #### getDataset

          public PieDataset3D getDataset()

      Returns the dataset.
      Returns:
        The dataset (never `null`).

    - #### setDataset

          public void setDataset(PieDataset3D dataset)

      Sets the dataset and notifies registered listeners that the dataset has been updated.
      Parameters:
        `dataset` - the dataset (`null` not permitted).

    - #### getRadius

          public double getRadius()

      Returns the radius of the pie (the default value is 8.0).
      Returns:
        The radius of the pie.

    - #### setRadius

          public void setRadius(double radius)

      Sets the radius of the pie chart and sends a change event to all registered listeners.
      Parameters:
        `radius` - the radius.

    - #### getDepth

          public double getDepth()

      Returns the depth of the pie (the default value is 2.0).
      Returns:
        The depth of the pie.

    - #### setDepth

          public void setDepth(double depth)

      Sets the depth of the pie chart and sends a change event to all registered listeners.
      Parameters:
        `depth` - the depth.

    - #### getSectionColorSource

          public ColorSource getSectionColorSource()

      Returns the color source for section colors.
      Returns:
        The color source (never `null`).

    - #### setSectionColorSource

          public void setSectionColorSource(ColorSource source)

      Sets the color source and sends a `Plot3DChangeEvent` to all registered listeners.
      Parameters:
        `source` - the color source (`null` not permitted).

    - #### setSectionColors

          public void setSectionColors(java.awt.Color... colors)

      Sets a new color source for the plot using the specified colors and sends a `Plot3DChangeEvent` to all registered listeners. This is a convenience method that is equivalent to `setSectionColorSource(new StandardColorSource(colors))`.
      Parameters:
        `colors` - one or more colors (`null` not permitted).
      Since:
        1.2

    - #### getSectionLabelGenerator

          public PieLabelGenerator getSectionLabelGenerator()

      Returns the object that creates labels for each section of the pie chart.
      Returns:
        The section label generator (never `null`).
      Since:
        1.2

    - #### setSectionLabelGenerator

          public void setSectionLabelGenerator(PieLabelGenerator generator)

      Sets the object that creates labels for each section of the pie chart, and sends a `Plot3DChangeEvent` to all registered listeners.
      Parameters:
        `generator` - the generator (`null` not permitted).
      Since:
        1.2

    - #### getSectionLabelFontSource

          public FontSource getSectionLabelFontSource()

      Returns the font source that is used to determine the font to use for the section labels.
      Returns:
        The font source for the section labels (never `null`).

    - #### setSectionLabelFontSource

          public void setSectionLabelFontSource(FontSource source)

      Sets the font source and sends a `Plot3DChangeEvent` to all registered listeners.
      Parameters:
        `source` - the source (`null` not permitted).

    - #### getSectionLabelColorSource

          public ColorSource getSectionLabelColorSource()

      Returns the color source for section labels. The default value is an instance of `StandardColorSource` that always returns `Color.BLACK`.
      Returns:
        The color source (never `null`).
      See Also:
        `setSectionLabelColorSource(ColorSource)`

    - #### setSectionLabelColorSource

          public void setSectionLabelColorSource(ColorSource source)

      Sets the color source for the section labels and sends a `Plot3DChangeEvent` to all registered listeners.
      Parameters:
        `source` - the color source.
      See Also:
        `getSectionLabelColorSource()`

    - #### getLegendLabelGenerator

          public PieLabelGenerator getLegendLabelGenerator()

      Returns the object that creates legend labels for each section of the pie chart.
      Returns:
        The legend label generator (never `null`).
      Since:
        1.2

    - #### setLegendLabelGenerator

          public void setLegendLabelGenerator(PieLabelGenerator generator)

      Sets the object that creates legend labels for each section of the pie chart, and sends a `Plot3DChangeEvent` to all registered listeners.
      Parameters:
        `generator` - the generator (`null` not permitted).
      Since:
        1.2

    - #### getToolTipGenerator

          public PieLabelGenerator getToolTipGenerator()

      Returns the tool tip generator.
      Returns:
        The tool tip generator (possibly `null`).
      Since:
        1.3

    - #### setToolTipGenerator

          public void setToolTipGenerator(PieLabelGenerator generator)

      Sets the tool tip generator and sends a change event to all registered listeners.
      Parameters:
        `generator` - the generator (`null` permitted).
      Since:
        1.3

    - #### getDimensions

          public Dimension3D getDimensions()

      Returns the dimensions for the plot. For the pie chart, it is more natural to specify the dimensions in terms of a radius and a depth, so we use those values to calculate the dimensions here.
      Specified by:
        `getDimensions` in interface `Plot3D`
      Overrides:
        `getDimensions` in class `AbstractPlot3D`
      Returns:
        The dimensions for the plot.
      See Also:
        `AbstractPlot3D.isAutoAdjustDimensions()`

    - #### getSegmentCount

          public int getSegmentCount()

      Returns the number of segments used when composing the 3D objects representing the pie chart. The default value is `40`.
      Returns:
        The number of segments used to compose the pie chart.

    - #### setSegmentCount

          public void setSegmentCount(int count)

      Sets the number of segments used when composing the pie chart and sends a `Plot3DChangeEvent` to all registered listeners. A higher number will result in a more rounded pie chart, but will take longer to render.
      Parameters:
        `count` - the count.

    - #### getLegendInfo

          public java.util.List<LegendItemInfo> getLegendInfo()

      Returns a list containing legend item info, typically one item for each series in the chart. This is intended for use in the construction of a chart legend.
      Specified by:
        `getLegendInfo` in interface `Plot3D`
      Returns:
        A list containing legend item info.

    - #### compose

          public void compose(World world,
                              double xOffset,
                              double yOffset,
                              double zOffset)

      Adds 3D objects representing the current data for the plot to the specified world. After the world has been populated (or constructed) in this way, it is ready for rendering. This method is called by the `Chart3D` class, you won't normally call it directly.
      Specified by:
        `compose` in interface `Plot3D`
      Parameters:
        `world` - the world (`null` not permitted).
        `xOffset` - the x-offset.
        `yOffset` - the y-offset.
        `zOffset` - the z-offset.

    - #### getLabelFaces

          public java.util.List<Object3D> getLabelFaces(double xOffset,
                                                        double yOffset,
                                                        double zOffset)

      Returns a list of label faces for the plot. These are non-visible objects added to the 3D model of the pie chart to track the positions for labels (which are added after the plot is projected and rendered).
      NOTE: This method is public so that it can be called by the `Chart3D` class - you won't normally call it directly.
      Parameters:
        `xOffset` - the x-offset.
        `yOffset` - the y-offset.
        `zOffset` - the z-offset.
      Returns:
        A list of label faces.

    - #### generateToolTipText

          public java.lang.String generateToolTipText(ItemKey itemKey)

      Description copied from class: `AbstractPlot3D`
      Returns the tool tip text for the specified data item, or `null` if no tool tip is required.
      Specified by:
        `generateToolTipText` in interface `Plot3D`
      Specified by:
        `generateToolTipText` in class `AbstractPlot3D`
      Parameters:
        `itemKey` - the item key (`null` not permitted).
      Returns:
        The tool tip text (possibly `null`).

    - #### receive

          public void receive(ChartElementVisitor visitor)

      Receives a visitor. This is a general purpose mechanism, but the main use is to apply chart style changes across all the elements of a chart.
      Specified by:
        `receive` in interface `ChartElement`
      Specified by:
        `receive` in class `AbstractPlot3D`
      Parameters:
        `visitor` - the visitor (`null` not permitted).
      Since:
        1.2

    - #### equals

          public boolean equals(java.lang.Object obj)

      Tests this plot for equality with an arbitrary object. Note that the plot's dataset is NOT considered in the equality test.
      Overrides:
        `equals` in class `AbstractPlot3D`
      Parameters:
        `obj` - the object (`null` not permitted).
      Returns:
        A boolean.

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`