com.googlecode.charts4j
Class Slice

java.lang.Object
  extended by com.googlecode.charts4j.Slice

public class Slice
extends Object

Slice of pie for a PieChart. If the number of colors specified is less than the number of slices, then colors are interpolated. If no colors are specified, pie segment colors are interpolated from dark orange to pale yellow.

Author:
Julien Chastang (julien.c.chastang at gmail dot com)
See Also:
PieChart, GCharts

Method Summary
 Color getColor()
          Get the color for this slice of the pie.
 String getLabel()
          Get the pie slice label.
 int getPercentage()
          Get the percentage for this slice of the pie.
static Slice newSlice(int percent, Color color)
          Create a pie slice.
static Slice newSlice(int percent, Color color, String sliceLabel)
          Create a pie slice.
static Slice newSlice(int percent, String sliceLabel)
          Create a pie slice.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getPercentage

public final int getPercentage()
Get the percentage for this slice of the pie.

Returns:
percentage that this slice will take of the pie.

getColor

public final Color getColor()
Get the color for this slice of the pie.

Returns:
color of pie slice.

getLabel

public final String getLabel()
Get the pie slice label.

Returns:
label of pie slice.

newSlice

public static Slice newSlice(int percent,
                             Color color,
                             String sliceLabel)
Create a pie slice.

Parameters:
percent - percent of pie. Must be between 0 to 100.
color - color of slice. Cannot be null
sliceLabel - label associated with slice. Cannot be null.
Returns:
a slice of pie.

newSlice

public static Slice newSlice(int percent,
                             Color color)
Create a pie slice.

Parameters:
percent - percent of pie. Must be between 0 to 100.
color - color of slice. Cannot be null.
Returns:
a slice of pie.

newSlice

public static Slice newSlice(int percent,
                             String sliceLabel)
Create a pie slice.

Parameters:
percent - percent of pie. Must be between 0 to 100.
sliceLabel - label associated with slice. Cannot be null.
Returns:
a slice of pie.