com.objectplanet.chart
Class PieChart

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by com.objectplanet.chart.GenericChart
                  extended by com.objectplanet.chart.Chart
                      extended by com.objectplanet.chart.PieChart
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.ItemSelectable, java.awt.MenuContainer, java.io.Serializable

public class PieChart
extends Chart

This pie chart component enables you to add a pie chart to your java applications with just a few lines of code.

A simple pie chart can be created with the following code:

 PieChart chart = new PieChart(5);
 long[] values = new long[] {100, 200, 300, 400, 500};
 chart.setSampleValues(values);
A chart with the legend turned on and displayed in 3D can be created with the following code:
 PieChart chart = new PieChart(5);
 long[] values = new long[] {100, 200, 300, 400, 500};
 chart.setSampleValues(values);
 chart.setLegendOn(true);
 chart.set3DModeOn(true);

See here for a list of parameters to set for the pie chart.

Author:
Bjorn J. Kvande.
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static int SELECTION_STYLE_CIRCLE
          Used to mark a selected pie segment with a indented circle
static int SELECTION_STYLE_DETACHED
          Used to mark a selected pie segment as detached from the pie
static int SELECTION_STYLE_TRIANGLE
          Used to mark a selected pie segment with a triangle
 
Fields inherited from class com.objectplanet.chart.Chart
BELOW, BELOW_AND_FLOATING, BOTTOM, chartData, FLOATING, HORIZONTAL, INSIDE, LEFT, OUTSIDE, POINTING, RIGHT, TARGET_LINE_ID_AND_VALUE_LABEL, TARGET_LINE_ID_LABEL, TARGET_LINE_NO_LABEL, TARGET_LINE_VALUE_LABEL, TOP, VERTICAL, visibleSamples
 
Fields inherited from class com.objectplanet.chart.GenericChart
chartType, DEFAULT_SAMPLE_COLORS, depth3dPoint, display3dOn, displayVersionOn, dragged_label, grid, gridRenderer, legend, legendRenderer, legendSelection, needChartCalculation, needGraphBounds, needRender, new_cursor, old_cursor, overlayCharts, renderer
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
PieChart()
          Creates a pie chart with 1 sample.
PieChart(int sampleCount)
          Creates a pie chart with the given number of pie segments.
PieChart(int seriesCount, int sampleCount)
          Creates a pie chart with the given number of series and samples.
 
Method Summary
protected  void checkDataIntegrity()
          Makes sure the linechart specific data has the same number of series and samples as the chart data has.
 ChartSample checkSelection(java.awt.Point point)
          This method is called when the user releases the mouse and checks if the given point is inside a bar or a legend label.
protected  java.lang.String constructLabel(int series, int sample, int style, boolean paintSeriesOn, java.lang.String percentLabel)
          Constructs the combination of labels.
 int getAngle()
          Gets the angle of the pie chart.
 float getDepth()
          Gets the depth of the pie.
 double getDetachedDistance()
          Gets the default detach distance.
 double getDetachedSlice(int serie, int index)
          Gets the distance a pie slice is detached from the given pie.
 java.awt.Color getInsideLabelColor(int index)
          Gets the color of the inside labels of the specified pie.
 java.awt.Color getOutsideLabelColor(int index)
          Gets the color of the outside labels of the specified pie.
 int getPercentDecimalCount()
          Gets the number of decimals used with the percent values.
 int getPercentLabelStyle()
          Gets the style of the percent labels.
 double getPercentValue(int serie, int index)
          Gets the value of the given pie segment as a percentage value (out of 100).
 java.awt.Color getPointingLabelColor(int index)
          Gets the color of the pointing labels of the specified pie.
 int getSelectionStyle()
          Gets the current selection style.
 java.awt.Polygon getSlicePolygon(int serie, int sample)
          Gets the polygon describing the pie slice.
 java.awt.Color getSliceSeperatorColor()
          Gets the current pie slice seperator line color.
 int getStartAngle(int index)
          Gets the angle of the initial starting point of the slices.
protected  java.awt.Rectangle getTotalGraphBounds()
          Gets total bounds of all pies on the chart.
 boolean isGradientSamplesOn()
           
 boolean isPercentLabelsOn()
          Checks if the percent labels are turned on.
 boolean isPieLabelsOn()
          Checks if the pie lablels are turned on.
 boolean isPieRotationOn()
          Checks if the pie rotation is on or off.
 boolean isSliceSeperatorOn()
          Checks if the pie slice seperators are on.
protected  void processEvent(java.awt.AWTEvent e)
          Handles the chart events.
 void reset()
          Resets the chart data and features.
 void setAngle(int angle)
          Sets the angle of the pie chart.
 void setDepth(double depth)
          Sets the depth of the pie.
 void setDetachedDistance(double distance)
          Sets the default detach distance when detached selection style is set.
 void setDetachedSlice(int serie, int index, double distance)
          Detaches a pie slice.
 void setFont(java.lang.String label, java.awt.Font font)
          Sets the font for the title, legend, pie labels, sample labels, percent labels, or value labels.
 void setGradientSamplesOn(boolean on)
           
 void setInsideLabelColor(int index, java.awt.Color color)
          Sets the color of the inside labels for the specified pie.
 void setOutsideLabelColor(int index, java.awt.Color color)
          Sets the color of the outside labels for the specified pie.
 void setPercentDecimalCount(int count)
          Sets the number of decimals to use with the percent values.
 void setPercentLabelsOn(boolean on)
          Display percent labels when the mouse pointer is above the pie segment.
 void setPercentLabelStyle(int style)
          Sets the style of the percent labels.
 void setPieLabelsOn(boolean on)
          Use this to display the sample labels below each pie when multiple data series (multiple pies) are used.
 void setPieRotationOn(boolean on)
          Set pie rotation on or off.
 void setPointingLabelColor(int index, java.awt.Color color)
          Sets the color of the pointing labels for the specified pie.
 void setSelectionStyle(int style)
          Sets the selection style.
 void setSliceSeperatorColor(java.awt.Color color)
          Sets the pie slice seperator line color.
 void setSliceSeperatorOn(boolean state)
          Turns on or off the pie slice seperator lines.
 void setStartAngle(int angle)
          Sets the angle of the initial starting point of the slices.
 void setStartAngle(int index, int angle)
          Sets the angle of the initial starting point of the slices for the specified pie.
 
Methods inherited from class com.objectplanet.chart.Chart
addItemListener, appendSample, appendSampleLabel, appendSampleValue, calculateChartData, displayFloatingLabel, formatRangeNumber, formatSeriesNumber, get3DDepth, getAngledLabelCache, getChartData, getCurrentLowerRange, getCurrentRange, getDataBounds, getGridLine, getGridLineColor, getGridLineColors, getGridLines, getHighestValue, getLabelSize, getLastSelectedSample, getLastSelectedSeries, getLegendColor, getLegendLabels, getLowerRange, getLowestValue, getMaxValue, getMaxValueLineCount, getMinValue, getRange, getRangeAdjusted, getRangeAdjusterPosition, getRangeColor, getRangeCount, getRangeDecimalCount, getRangeFormatter, getRangeInterval, getRangePosition, getSample, getSample, getSampleColor, getSampleColor2, getSampleColors, getSampleColors2, getSampleCount, getSampleDecimalCount, getSampleLabel, getSampleLabelColor, getSampleLabels, getSampleLabelSelectionColor, getSampleLabelStyle, getSamples, getSampleValue, getSampleValues, getSelectedObjects, getSeriesCount, getSeriesFormatter, getSeriesLabel, getSeriesLabelColor, getSeriesLabels, getSeriesLabelStyle, getSeriesRange, getStringValues, getTargetLabelsPosition, getTargetValueLine, getValueLabelColor, getValueLabelStyle, getValueLinesColor, getVisibleSamples, hasDataChangedSince, hashCode, isDefaultGridLinesOn, isGridAdjustmentOn, isLegendBoxSizeAsFont, isRangeAdjusterOn, isRangeLabelsOn, isRangeOn, isSampleLabelsOn, isSampleScrollerOn, isSelected, isSeriesEmpty, isSeriesLabelsOn, isValueLabelsOn, isValueLabelsOn, isValueLinesOn, main, paintGrid, removeItemListener, renderData, set3DDepth, setChartData, setCurrentLowerRange, setCurrentRange, setDefaultGridLinesColor, setDefaultGridLinesOn, setDefaultGridLinesOn, setGridAdjustmentOn, setGridLine, setGridLineColor, setGridLineColors, setGridLines, setGridLinesColor, setLegendBoxSizeAsFont, setLowerRange, setLowerRelativeRange, setLowerRelativeRange, setLowerRelativeRange, setMaxValueLineCount, setRange, setRangeAdjusted, setRangeAdjusterOn, setRangeAdjusterPosition, setRangeColor, setRangeDecimalCount, setRangeFormatter, setRangeInterval, setRangeLabelsOn, setRangeOn, setRangePosition, setRelativeRange, setRelativeRange, setRelativeRange, setSample, setSampleAxisRange, setSampleColor, setSampleColor2, setSampleColors, setSampleColors2, setSampleCount, setSampleDecimalCount, setSampleLabel, setSampleLabelColor, setSampleLabels, setSampleLabelSelectionColor, setSampleLabelsOn, setSampleLabelStyle, setSamples, setSampleScrollerOn, setSampleValue, setSampleValues, setSelection, setSelection, setSelection, setSeriesCount, setSeriesFormatter, setSeriesLabel, setSeriesLabelColor, setSeriesLabels, setSeriesLabelsOn, setSeriesLabelStyle, setSeriesRange, setTargetLabelsPosition, setTargetValueLine, setTargetValueLine, setValueLabelColor, setValueLabelsOn, setValueLabelsOn, setValueLabelStyle, setValueLinesColor, setValueLinesOn, setVisibleSamples, setVisibleSamples
 
Methods inherited from class com.objectplanet.chart.GenericChart
addImage, addOverlayChart, autoRepaint, clearAngledLabelCache, createImage_oldstyle, createImage, forceRepaint, formatNumber, getAlternateChartBackground, getBackground2, getChartBackground, getChartBackground2, getChartForeground, getFont, getGraphBounds, getGraphInsets, getGridImage, getImage, getImage, getLabel, getLabelAngle, getLabelAtPoint, getLabelBounds, getLabelColor, getLabelPosition, getLegendColors, getLegendColumns, getLegendImage, getLegendPosition, getLocale, getMinimumSize, getOverlayChart, getOverlayInsets, getPreferredSize, getSize, getThousandsDelimeter, getTitle, getVersion, handleCustomLabels, is3DModeOn, isAntialiasingOn, isAutomaticRepaintOn, isFloatingOnLegendOn, isGridOutline3DOn, isLegendOn, isLegendReverseOn, isMultiSeriesOn, isOverlayChartOn, isPrintAsBitmap, isSampleHighlightOn, isServletModeOn, isTitleOn, isZoomOn, loadImage, paint, print, removeExternalGraphics, removeOverlayChart, render, render, renderOffScreen, set3DModeOn, setAlternateChartBackground, setAntialiasingOn, setAutomaticRepaintOn, setBackground, setBackground2, setChartBackground, setChartBackground2, setChartForeground, setExternalGraphics, setFloatingOnLegendOn, setForeground, setGraphInsets, setGridImage, setGridOutline3DOn, setLabel, setLabel, setLabel, setLabel, setLabel, setLabelAngle, setLabelAngleCacheSize, setLabelColor, setLabelPosition, setLabelPosition, setLabelURL, setLegendColor, setLegendColors, setLegendColumns, setLegendImage, setLegendLabels, setLegendOn, setLegendPosition, setLegendReverseOn, setLocale, setMultiSeriesOn, setNeedChartCalculation, setOverlayChart, setOverlayChartOn, setOverlayInsets, setPreferredSize, setPrintAsBitmap, setServletModeOn, setThousandsDelimiter, setTitle, setTitleOn, setZoomOn, toString, update
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocation, setLocation, setName, setSize, setSize, show, show, size, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SELECTION_STYLE_CIRCLE

public static final int SELECTION_STYLE_CIRCLE
Used to mark a selected pie segment with a indented circle

See Also:
Constant Field Values

SELECTION_STYLE_DETACHED

public static final int SELECTION_STYLE_DETACHED
Used to mark a selected pie segment as detached from the pie

See Also:
Constant Field Values

SELECTION_STYLE_TRIANGLE

public static final int SELECTION_STYLE_TRIANGLE
Used to mark a selected pie segment with a triangle

See Also:
Constant Field Values
Constructor Detail

PieChart

public PieChart()
Creates a pie chart with 1 sample.


PieChart

public PieChart(int sampleCount)
Creates a pie chart with the given number of pie segments.

Parameters:
sampleCount - The number of pie segments for the chart.

PieChart

public PieChart(int seriesCount,
                int sampleCount)
Creates a pie chart with the given number of series and samples.

Parameters:
seriesCount - The number of pies.
sampleCount - The number of segments in each pie.
Method Detail

checkDataIntegrity

protected void checkDataIntegrity()
Makes sure the linechart specific data has the same number of series and samples as the chart data has.

Overrides:
checkDataIntegrity in class Chart

checkSelection

public ChartSample checkSelection(java.awt.Point point)
This method is called when the user releases the mouse and checks if the given point is inside a bar or a legend label.

Overrides:
checkSelection in class Chart
Parameters:
point - The point clicked on.
Returns:
The bar selected, or null if no bar was selected.

constructLabel

protected java.lang.String constructLabel(int series,
                                          int sample,
                                          int style,
                                          boolean paintSeriesOn,
                                          java.lang.String percentLabel)
Constructs the combination of labels.

Overrides:
constructLabel in class Chart
Parameters:
series - The series index.
sample - The sample index.
style - The style of the label: INSIDE, OUTSIDE, FLOATING or POINTING.
paintSeriesOn - True if the series label should be on.
percentLabel - A percent label for pie chart.
Returns:
The constructed label.

getAngle

public int getAngle()
Gets the angle of the pie chart.

Returns:
The angle in degrees (0-90).

getDepth

public float getDepth()
Gets the depth of the pie.

Returns:
a float in the range 0.0-1.0.

getDetachedDistance

public double getDetachedDistance()
Gets the default detach distance.

See Also:
setDetachedDistance(double)

getDetachedSlice

public double getDetachedSlice(int serie,
                               int index)
Gets the distance a pie slice is detached from the given pie.

Parameters:
serie - The series index of the slice.
index - The sample index of the slice.
Returns:
The distance as a factor of the pie size, 0 if not detached.

getInsideLabelColor

public java.awt.Color getInsideLabelColor(int index)
Gets the color of the inside labels of the specified pie. Use -1 as parameter to get default inside label color.

Parameters:
index - The index of the pie (0-based).
Returns:
The color, or null if no color is set.
Throws:
java.lang.IllegalArgumentException - if the pie index is invalid.

getOutsideLabelColor

public java.awt.Color getOutsideLabelColor(int index)
Gets the color of the outside labels of the specified pie. Use -1 as parameter to get default outside label color.

Parameters:
index - The index of the pie (0-based).
Returns:
The color, or null if no color is set.
Throws:
java.lang.IllegalArgumentException - if the pie index is invalid.

getPercentDecimalCount

public int getPercentDecimalCount()
Gets the number of decimals used with the percent values.


getPercentLabelStyle

public int getPercentLabelStyle()
Gets the style of the percent labels.

Returns:
FLOATING or INSIDE.
See Also:
setPercentLabelStyle(int)

getPercentValue

public double getPercentValue(int serie,
                              int index)
Gets the value of the given pie segment as a percentage value (out of 100).

Parameters:
serie - The index of the serie (0-based).
index - The index of the pie segment (0-based).
Returns:
The number of percent the specified segment occupies.
Throws:
java.lang.IllegalArgumentException - If the index or series is invalid.

getPointingLabelColor

public java.awt.Color getPointingLabelColor(int index)
Gets the color of the pointing labels of the specified pie. Use -1 as parameter to get default pointing label color.

Parameters:
index - The index of the pie (0-based).
Returns:
The color, or null if no color is set.
Throws:
java.lang.IllegalArgumentException - if the pie index is invalid.

getSelectionStyle

public int getSelectionStyle()
Gets the current selection style.

Returns:
SELECTION_STYLE_CIRCLE, SELECTION_STYLE_TRIANGLE, SELECTION_STYLE_DETACHED.
See Also:
setSelectionStyle(int)

getSlicePolygon

public java.awt.Polygon getSlicePolygon(int serie,
                                        int sample)
Gets the polygon describing the pie slice.

Parameters:
serie - The series index
sample - The sample index.
Returns:
The polygon describing the pie slice.

getSliceSeperatorColor

public java.awt.Color getSliceSeperatorColor()
Gets the current pie slice seperator line color.

Returns:
The color, or null if no color is set.

getStartAngle

public int getStartAngle(int index)
Gets the angle of the initial starting point of the slices. The default angle is 0 which corresponds to 12 o'clock.


getTotalGraphBounds

protected java.awt.Rectangle getTotalGraphBounds()
Gets total bounds of all pies on the chart.

Overrides:
getTotalGraphBounds in class GenericChart
Returns:
Rectangle that contains all pies inside.

isGradientSamplesOn

public boolean isGradientSamplesOn()

isPercentLabelsOn

public boolean isPercentLabelsOn()
Checks if the percent labels are turned on.

Returns:
True if on, false if off.

isPieLabelsOn

public boolean isPieLabelsOn()
Checks if the pie lablels are turned on.

Returns:
True for on, false for off.
See Also:
setPieLabelsOn(boolean)

isPieRotationOn

public boolean isPieRotationOn()
Checks if the pie rotation is on or off.

Returns:
True if on, false if off.

isSliceSeperatorOn

public boolean isSliceSeperatorOn()
Checks if the pie slice seperators are on.

Returns:
True for on, false for off.
See Also:
setSliceSeperatorOn(boolean)

processEvent

protected void processEvent(java.awt.AWTEvent e)
Handles the chart events.

Overrides:
processEvent in class Chart
Parameters:
e - The event to process.

reset

public void reset()
Resets the chart data and features.

Overrides:
reset in class Chart

setAngle

public void setAngle(int angle)
Sets the angle of the pie chart. The default angle is 20.

Parameters:
angle - (0-80).
See Also:
setDepth(double)

setDepth

public void setDepth(double depth)
Sets the depth of the pie. The depth is a fraction of the width of the pie. If the depth is set to 1.0, the depth is the same as the width. The default depth is set to 0.4.

Parameters:
depth - The depth (0.0-1.0).
See Also:
setAngle(int)

setDetachedDistance

public void setDetachedDistance(double distance)
Sets the default detach distance when detached selection style is set. The distance is relative to the radius of the pie. A distance of 0.5 will detach the slice halfway out the pie.

Parameters:
distance - The distance to use.
See Also:
setDetachedSlice(int, int, double)

setDetachedSlice

public void setDetachedSlice(int serie,
                             int index,
                             double distance)
Detaches a pie slice. The distance parameter is a factor of the pie radius. If the distance is set to 0.5 the slice will be detached halfway out from the pie. To reattach a slice, set the distance to 0.

Parameters:
serie - The series index of the slice.
index - The sample index of the slice.
distance - The distance as a factor of the pie size.

setFont

public void setFont(java.lang.String label,
                    java.awt.Font font)
Sets the font for the title, legend, pie labels, sample labels, percent labels, or value labels.

Overrides:
setFont in class GenericChart
Parameters:
label - "titleFont", "legendFont", "pieLabelFont", "floatingLabelFont".
font - The font to set for the specified label.

setGradientSamplesOn

public void setGradientSamplesOn(boolean on)

setInsideLabelColor

public void setInsideLabelColor(int index,
                                java.awt.Color color)
Sets the color of the inside labels for the specified pie. To set the color for all pies if index is -1.

Parameters:
index - The index of the pie (0-based).
color - The color to use, null for the default color.
Throws:
java.lang.IllegalArgumentException - if the pie index is invalid.

setOutsideLabelColor

public void setOutsideLabelColor(int index,
                                 java.awt.Color color)
Sets the color of the outside labels for the specified pie. To set the color for all pies if index is -1.

Parameters:
index - The index of the pie (0-based).
color - The color to use, null for the default color.
Throws:
java.lang.IllegalArgumentException - if the pie index is invalid.

setPercentDecimalCount

public void setPercentDecimalCount(int count)
Sets the number of decimals to use with the percent values. The default is 0 decimals.

Parameters:
count - The number of decimals to use.

setPercentLabelsOn

public void setPercentLabelsOn(boolean on)
Display percent labels when the mouse pointer is above the pie segment. The label shows the percent the pie segment occupies of the whole pie. If the value labels are turned on both of them will be displayed.

Parameters:
on - True for on, false for off.
See Also:
Chart.setValueLabelsOn(boolean)

setPercentLabelStyle

public void setPercentLabelStyle(int style)
Sets the style of the percent labels. The percent labels can be displayed floating over the slice when the mouse is over it or statically inside each slice. The default style is floating.

Parameters:
style - FLOATING, INSIDE, OUTSIDE or POINTING.

setPieLabelsOn

public void setPieLabelsOn(boolean on)
Use this to display the sample labels below each pie when multiple data series (multiple pies) are used.

Parameters:
on - True for on, false for off (default).

setPieRotationOn

public void setPieRotationOn(boolean on)
Set pie rotation on or off. If on, pie is rotated when user drags mouse over the pie.

Parameters:
on - True for on, false for off.

setPointingLabelColor

public void setPointingLabelColor(int index,
                                  java.awt.Color color)
Sets the color of the pointing labels for the specified pie. To set the color for all pies if index is -1.

Parameters:
index - The index of the pie (0-based).
color - The color to use, null for the default color.
Throws:
java.lang.IllegalArgumentException - if the pie index is invalid.

setSelectionStyle

public void setSelectionStyle(int style)
Sets the selection style. A selection marker is painted when the user selects a pie slice. The selection marker can either be a circle in the slice, a triangle in the slice, or the whole slice can be detached when selected.

Parameters:
style - SELECTION_STYLE_CIRCLE, SELECTION_STYLE_TRIANGLE, SELECTION_STYLE_DETACHED.

setSliceSeperatorColor

public void setSliceSeperatorColor(java.awt.Color color)
Sets the pie slice seperator line color. If the color set is null, the color defaults to be a little darker than the pie segment itself.

Parameters:
color - The color to use.

setSliceSeperatorOn

public void setSliceSeperatorOn(boolean state)
Turns on or off the pie slice seperator lines. When this is on, a line will be painted between each slice to seperate them. By default the color of the slice seperator line is the same color as the slice, only darker. Use setSliceSeperatorColor(Color) to control the seperator line color.

Parameters:
state - True for on, false for off.

setStartAngle

public void setStartAngle(int angle)
Sets the angle of the initial starting point of the slices. The default angle is 0 which corresponds to 12 o'clock.

Parameters:
angle - ( from -360 to +360).
See Also:
setPieRotationOn(boolean)

setStartAngle

public void setStartAngle(int index,
                          int angle)
Sets the angle of the initial starting point of the slices for the specified pie. The default angle is 0 which corresponds to 12 o'clock.

Parameters:
angle - ( from -360 to +360).
See Also:
setPieRotationOn(boolean)