Chart FX 7 for Java Server

com.softwarefx.chartfx.server.galleries
Class Pie

java.lang.Object
  extended by com.softwarefx.chartfx.server.galleries.Pie
All Implemented Interfaces:
IGallery

public class Pie
extends Object
implements IGallery

Provides access to the Pie and Doughnut gallery objects.

The properties of the Pie Class allow you to customize the visual attributes of a Pie chart. In order to make the supported members available, you must first set the gallery of the chart to Pie, and cast the Chart.setGalleryAttributes(com.softwarefx.chartfx.server.IGallery) property of the Chart to the Pie Class :

Pir pie = (Pie) chart1.getGalleryAttributes();

The cast will fail if the gallery is not set to Pie or Doughnut.

Once you have done this, using the newly created object you can assign these special attributes for the Pie or Doughnut gallery type in your chart.

By default, if Chart FX for Java concludes that drawing a label inside a Pie chart will make the readability of the chart harder, this label is drawn outside the chart. You can set LabelsInside to false to force Chart FX for Java to draw all the labels outside the Chart. The following chart illustrates the default behavior of the Pie chart:

The gallery of the chart can also be set to a Doughnut. The attributes object of the Doughnut gallery is of type Pie:


Constructor Summary
Pie()
           
 
Method Summary
 int getDoughnutThickness()
          Gets the DoughnutThickness.
 ExplodingMode getExplodingMode()
          Gets the ExplodingMode.
 int getLabelLineBreak()
          Gets the LabelLineBreak.
 int getMaximumLabelMargin()
          Gets the MaximumLabelMargin.
 int getSliceSeparation()
          Gets the SliceSeparation.
 int getStartAngle()
          Gets the StartAngle.
 boolean isLabelsInside()
          Gets the LabelsInside.
 boolean isShadows()
          Gets the Shadows.
 boolean isShowLines()
          Gets the ShowLines.
 boolean isSquare()
          Gets the Square.
 boolean isStacked()
          Gets the Stacked.
 void setDoughnutThickness(int value)
          Controls the thickness of the doughnut as a percentage of the outside radius.
 void setExplodingMode(ExplodingMode value)
          Allows you to set how the slices of a pie chart are displayed.
 void setLabelLineBreak(int value)
          Controls the line that connects the labels with its pie/doughnut slice.
 void setLabelsInside(boolean value)
          Instructs Chart FX for Java to try to paint the point labels directly on the corresponding slice of a Pie chart.
 void setMaximumLabelMargin(int value)
          Sets the maximum margin (in pixels) allowed between the labels and the borders of the pie chart.
 void setShadows(boolean value)
          Adds a shadow effect to a 2D pie chart.
 void setShowLines(boolean value)
          Shows or hides lines which connect the point labels to a Pie chart.
 void setSliceSeparation(int value)
          Sets the pie slice separation (in pixels) when using the ExplodingMode property.
 void setSquare(boolean value)
          Forces Pie charts to be contained in a perfect square (no matter the window proportion).
 void setStacked(boolean value)
          Sets a Boolean value specifying whether or not to stack a pie/doughnut chart.
 void setStartAngle(int value)
          Sets a value specifying the starting angle of the first slice in a pie chart.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Pie

public Pie()
Method Detail

getDoughnutThickness

public int getDoughnutThickness()

Gets the DoughnutThickness. For more detail see setDoughnutThickness(int).


getExplodingMode

public ExplodingMode getExplodingMode()

Gets the ExplodingMode. For more detail see setExplodingMode(com.softwarefx.chartfx.server.galleries.ExplodingMode).


getLabelLineBreak

public int getLabelLineBreak()

Gets the LabelLineBreak. For more detail see setLabelLineBreak(int).


getMaximumLabelMargin

public int getMaximumLabelMargin()

Gets the MaximumLabelMargin. For more detail see setMaximumLabelMargin(int).


getSliceSeparation

public int getSliceSeparation()

Gets the SliceSeparation. For more detail see setSliceSeparation(int).


getStartAngle

public int getStartAngle()

Gets the StartAngle. For more detail see setStartAngle(int).


isLabelsInside

public boolean isLabelsInside()

Gets the LabelsInside. For more detail see setLabelsInside(boolean).


isShadows

public boolean isShadows()

Gets the Shadows. For more detail see setShadows(boolean).


isShowLines

public boolean isShowLines()

Gets the ShowLines. For more detail see setShowLines(boolean).


isSquare

public boolean isSquare()

Gets the Square. For more detail see setSquare(boolean).


isStacked

public boolean isStacked()

Gets the Stacked. For more detail see setStacked(boolean).


setDoughnutThickness

public void setDoughnutThickness(int value)

Controls the thickness of the doughnut as a percentage of the outside radius.

Remarks:
  • The default value is 50 which means the radius of the hole is half of the radius of the outer wall. As this value decreases, the doughnut becomes thinner.

  • When the setStacked(boolean) property is set to true, a multi-series pie/doughnut chart will draw each series on top of each other (2D Only) instead of side-by-side:

    The PointAttributes.setVolume(short) property may be used to control the size of each series. Series 0 is painted behind the others, so it should be set as the largest (e.g. Volume = 100).

  • See Also:
    Chart.setGallery(com.softwarefx.chartfx.server.Gallery), Chart.setGalleryAttributes(com.softwarefx.chartfx.server.IGallery), setStacked(boolean), PointAttributes.setVolume(short), Chart

    setExplodingMode

    public void setExplodingMode(ExplodingMode value)

    Allows you to set how the slices of a pie chart are displayed.

    Remarks:
  • You can set the distance a slice will be separated from the pie chart using the setSliceSeparation(int) property.

  • Below, the pie is set to the Full exploding mode:

    Alternatively, the Pie chart is here set to the First exploding mode:

  • See Also:
    setSliceSeparation(int), setSquare(boolean), Chart.setGallery(com.softwarefx.chartfx.server.Gallery), Chart

    setLabelLineBreak

    public void setLabelLineBreak(int value)

    Controls the line that connects the labels with its pie/doughnut slice. Notice that the setLabelsInside(boolean) property should be set to false.

    Remarks:
  • Below is a pie chart with a LabelLineBreak equal to 10 (default value):

    Below is a pie chart with a LabelLineBreak equal to 0. Notice that the line does not break:

    Below is a pie chart with a LabelLineBreak equal to 20:

  • See Also:
    setLabelsInside(boolean), setShowLines(boolean), Chart.setGallery(com.softwarefx.chartfx.server.Gallery), Chart.setGalleryAttributes(com.softwarefx.chartfx.server.IGallery), PointAttributes.getPointLabels(), PointLabelAttributes.setVisible(boolean), Chart, PointLabelAttributes

    setLabelsInside

    public void setLabelsInside(boolean value)

    Instructs Chart FX for Java to try to paint the point labels directly on the corresponding slice of a Pie chart.

    Remarks:
  • When point labels are painted outside of the Pie chart, lines will be added to improve chart readability. You can control how the lines break by using the setLabelLineBreak(int) property.

  • Below is a pie chart where the labels are inside. Notice that the size of the label font has been made smaller. If Chart FX for Java concludes that drawing a label inside a Pie chart will make Chart readability harder, this label will be drawn outside the chart.

    Below is a pie chart where the labels are outside:

  • See Also:
    Chart.setGallery(com.softwarefx.chartfx.server.Gallery), Chart.setGalleryAttributes(com.softwarefx.chartfx.server.IGallery), setLabelLineBreak(int), setShowLines(boolean), PointAttributes.getPointLabels(), PointLabelAttributes.setVisible(boolean), Chart, PointLabelAttributes

    setMaximumLabelMargin

    public void setMaximumLabelMargin(int value)

    Sets the maximum margin (in pixels) allowed between the labels and the borders of the pie chart.

    Remarks:
  • Alternatively, you can control the margins between the plot area and the border of the chart by using the Chart.getPlotAreaMargin()property of the Chart Class .

  • Below is the maximum label margin equal to 5:

    Below is the maximum label margin equal to 20:

    Below is the maximum label margin equal to 50:

  • See Also:
    Chart.setGallery(com.softwarefx.chartfx.server.Gallery), Chart.setGalleryAttributes(com.softwarefx.chartfx.server.IGallery), setLabelsInside(boolean), Chart.getPlotAreaMargin(), Chart, Margins

    setShadows

    public void setShadows(boolean value)

    Adds a shadow effect to a 2D pie chart.

    Remarks:
  • When the Shadows property is applied to a 2D Pie chart, the outside edges of the pie appear rounded:

  • The pie chart must be in 2D mode for this property to have an effect.

  • The default value for this propety is true.

  • See Also:
    Chart.setGallery(com.softwarefx.chartfx.server.Gallery), Chart.setGalleryAttributes(com.softwarefx.chartfx.server.IGallery), Chart.getView3D(), Chart, Attributes3D

    setShowLines

    public void setShowLines(boolean value)

    Shows or hides lines which connect the point labels to a Pie chart.

    Remarks:
  • When used in conjunction with a Pie chart, this property shows or hides the lines drawn from point labels to their corresponding pie slice. If the labels are inside the pie (i.e., setLabelsInside(boolean) = true) , this property will have no effect on the chart.

  • Below is a Pie chart where the lines are hidden:

  • See Also:
    Chart.setGallery(com.softwarefx.chartfx.server.Gallery), Chart.setGalleryAttributes(com.softwarefx.chartfx.server.IGallery), setLabelsInside(boolean), Chart

    setSliceSeparation

    public void setSliceSeparation(int value)

    Sets the pie slice separation (in pixels) when using the ExplodingMode property.

    Remarks:
  • Below is a Pie chart with SliceSeparation equal to 10:

    Below is a Pie chart with SliceSeparation equal to 25:

  • See Also:
    setExplodingMode(com.softwarefx.chartfx.server.galleries.ExplodingMode), Chart.setGallery(com.softwarefx.chartfx.server.Gallery), Chart.setGalleryAttributes(com.softwarefx.chartfx.server.IGallery), PointAttributes.setSeparateSlice(short), Chart, PointAttributes

    setSquare

    public void setSquare(boolean value)

    Forces Pie charts to be contained in a perfect square (no matter the window proportion).

    Remarks:
  • Below is a Pie chart which does not apply the square style:

  • See Also:
    Chart.setGallery(com.softwarefx.chartfx.server.Gallery), Chart.setGalleryAttributes(com.softwarefx.chartfx.server.IGallery), Chart

    setStacked

    public void setStacked(boolean value)

    Sets a Boolean value specifying whether or not to stack a pie/doughnut chart.

    Remarks:
  • When set to true, a multi-series pie/doughnut chart will draw each series on top of each other (2D Only) instead of side-by-side.

  • For more information on how to use Stacked, please refer to the documentation of the setDoughnutThickness(int) property.

  • See Also:
    setDoughnutThickness(int), SeriesAttributes.setStacked(boolean), Chart.setGallery(com.softwarefx.chartfx.server.Gallery), Chart.setGalleryAttributes(com.softwarefx.chartfx.server.IGallery), SeriesAttributes, Chart

    setStartAngle

    public void setStartAngle(int value)

    Sets a value specifying the starting angle of the first slice in a pie chart.

    Remarks:
  • This property may be configured with a value from 0 to 360.

  • See Also:
    setExplodingMode(com.softwarefx.chartfx.server.galleries.ExplodingMode), setLabelsInside(boolean), setShadows(boolean), setShowLines(boolean), setSliceSeparation(int), setStacked(boolean)

    http://www.softwarefx.com

    2008 Software FX, Inc. All Rights Reserved. Chart FX is a registered trademark of Software FX, Inc
    All other names are trademarks or registered trademarks of their respective owners.