public class PiePlot extends AbstractPlot implements Navigable
Class that displays data as segments of a pie plot. Empty segments are displayed for negative values.
To create a new PiePlot
simply create a new instance using
a data source. Example:
DataTable data = new DataTable(Integer.class, Double.class); data.add(-23.50); data.add(100.00); data.add( 60.25); PiePlot plot = new PiePlot(data);
Modifier and Type | Class and Description |
---|---|
static class |
PiePlot.PiePlotArea2D
Class that represents the drawing area of a
PiePlot . |
static class |
PiePlot.PiePlotLegend
A legend implementation for pie plots that displays items for each data
value of a data source.
|
static class |
PiePlot.PiePlotNavigator
Navigator implementation for pie plots.
|
static class |
PiePlot.PieSliceRenderer
A point renderer for a single slice in a pie plot.
|
protected static class |
PiePlot.Slice
Data class for storing slice information in world units.
|
Modifier and Type | Field and Description |
---|---|
static String |
AXIS_TANGENTIAL
Key for specifying the tangential axis of a pie plot.
|
static Key |
CENTER
Key for specifying
Point2D instance defining the
center of the pie. |
static Key |
CLOCKWISE
Key for specifying a
Boolean value which decides whether the
segments should be ordered clockwise (true ) or counterclockwise
(false ). |
static Key |
RADIUS
Key for specifying a
Number value for the radius of the pie
relative to the plot area size. |
static Key |
START
Key for specifying a
Number value for the starting angle of the
first segment in degrees. |
BACKGROUND, BORDER, COLOR, LEGEND, LEGEND_DISTANCE, LEGEND_LOCATION, TITLE, TITLE_FONT
Constructor and Description |
---|
PiePlot(DataSource data)
Initializes a new pie plot with the specified data source.
|
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
DataSource source,
boolean visible)
Inserts the specified data series to the plot at a specified position.
|
void |
autoscaleAxis(String axisName)
Tries to automatically set the ranges of the axes specified by the name
if it is set to auto-scale.
|
protected void |
createDefaultAxes()
Creates all axes that are defined by the current plot type.
|
protected void |
createDefaultAxisRenderers()
Creates all axis renderers that are defined by the current plot type.
|
protected void |
dataChanged(DataSource source,
DataChangeEvent... events)
Method that is invoked when data has been added, updated, or removed.
|
Navigator |
getNavigator()
Returns a navigator instance that can control the current object.
|
PointRenderer |
getPointRenderer(DataSource s)
Returns the
PointRenderer for the specified data source. |
protected PiePlot.Slice |
getSlice(DataSource source,
int index)
Returns the sum of all absolute values from the specified data source up
to the row with the specified index.
|
protected double |
getSum(DataSource source)
Returns the sum of all absolute values in the data column of a specified
data source.
|
protected void |
revalidate(DataSource source)
Rebuilds cached information for a specified data source.
|
void |
setPointRenderer(DataSource s,
PointRenderer pointRenderer)
Sets the
PointRenderer for a certain data source to the
specified value. |
void |
settingChanged(SettingChangeEvent event)
Invoked if a setting has changed.
|
add, add, autoscaleAxes, clear, contains, dataAdded, dataRemoved, dataUpdated, draw, drawAxes, drawLegend, get, getAxesNames, getAxis, getAxisComponent, getAxisMax, getAxisMin, getAxisRenderer, getData, getLegend, getLegendContainer, getMapping, getPlotArea, getTitle, getVisibleData, isVisible, layout, layoutAxes, layoutLegend, remove, removeAxis, setAxis, setAxisRenderer, setLegend, setMapping, setPlotArea, setVisible
getSetting, removeSetting, removeSettingDefault, setSetting, setSettingDefault
add, add, drawComponents, getConstraints, getDrawableAt, getInsets, getLayout, getPreferredSize, iterator, remove, setBounds, setBounds, setInsets, setLayout, size
getBounds, getHeight, getWidth, getX, getY
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getBounds, getHeight, getPreferredSize, getWidth, getX, getY, setBounds, setBounds
add, add, getBounds, getConstraints, getDrawableAt, getInsets, getLayout, remove, setBounds, setInsets, setLayout, size
getSetting, removeSetting, removeSettingDefault, setSetting, setSettingDefault
public static final String AXIS_TANGENTIAL
public static final Key CENTER
Point2D
instance defining the
center of the pie. The coordinates must be relative to the plot area
dimensions, i.e. 0.0 means left/top, 0.5 means the center, and 1.0 means
right/bottom.public static final Key RADIUS
Number
value for the radius of the pie
relative to the plot area size.public static final Key START
Number
value for the starting angle of the
first segment in degrees. The angle is applied counterclockwise.public PiePlot(DataSource data)
data
- Data to be displayed.protected void createDefaultAxes()
AbstractPlot
createDefaultAxes
in class AbstractPlot
public void autoscaleAxis(String axisName)
AbstractPlot
autoscaleAxis
in interface Plot
autoscaleAxis
in class AbstractPlot
axisName
- Name of the axis that should be scaled.Axis.setAutoscaled(boolean)
protected void createDefaultAxisRenderers()
AbstractPlot
createDefaultAxisRenderers
in class AbstractPlot
public void add(int index, DataSource source, boolean visible)
AbstractPlot
add
in interface Plot
add
in class AbstractPlot
index
- Position.source
- Data series.visible
- true
if the series should be displayed,
false
otherwise.public PointRenderer getPointRenderer(DataSource s)
PointRenderer
for the specified data source.s
- Data source.public void setPointRenderer(DataSource s, PointRenderer pointRenderer)
PointRenderer
for a certain data source to the
specified value.s
- Data source.pointRenderer
- PointRenderer to be set.public Navigator getNavigator()
getNavigator
in interface Navigable
protected PiePlot.Slice getSlice(DataSource source, int index)
source
- Data source.index
- Index of the row.protected double getSum(DataSource source)
source
- Data source.protected void revalidate(DataSource source)
source
- Data source.public void settingChanged(SettingChangeEvent event)
AbstractPlot
settingChanged
in interface SettingsListener
settingChanged
in class AbstractPlot
event
- Event containing information about the changed setting.protected void dataChanged(DataSource source, DataChangeEvent... events)
AbstractPlot
dataChanged
in class AbstractPlot
source
- Data source that has been changed.events
- Optional event object describing the data values that
have been changed.Copyright © 2009-2013. All Rights Reserved.