Class PiePlot3D

All Implemented Interfaces:
Serializable, EventListener, ChartElement, Dataset3DChangeListener, Plot3D

public class PiePlot3D extends AbstractPlot3D implements 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:
PieChart3DDemo1.svg


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:
  • Field Details

  • Constructor Details

    • PiePlot3D

      public PiePlot3D(PieDataset3D<? extends Comparable> dataset)
      Creates a new pie plot in 3D.
      Parameters:
      dataset - the dataset (null not permitted).
  • Method Details

    • getDataset

      public PieDataset3D<? extends Comparable> getDataset()
      Returns the dataset.
      Returns:
      The dataset (never null).
    • setDataset

      public void setDataset(PieDataset3D<? extends Comparable> 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

      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(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

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

      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

      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

      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

      Sets the color source for the section labels and sends a Plot3DChangeEvent to all registered listeners.
      Parameters:
      source - the color source.
      See Also:
    • 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

      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

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

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

      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(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 Object