|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.erichseifert.gral.AbstractDrawable
de.erichseifert.gral.DrawableContainer
de.erichseifert.gral.plots.Plot
public abstract class Plot
Abstract class that displays data in a plot. Functionality includes:
Field Summary | |
---|---|
static Settings.Key |
ANTIALISING
Key for specifying the whether antialiasing is enabled. |
static Settings.Key |
BACKGROUND
Key for specifying the Paint instance to be used to
paint the background of the plot. |
static Settings.Key |
BORDER
Key for specifying the Stroke instance to be used to
paint the border of the plot. |
static Settings.Key |
COLOR
Key for specifying the Paint instance to be used to
fill the border of the plot. |
static Settings.Key |
LEGEND
Key for specifying whether the legend should be shown. |
static Settings.Key |
LEGEND_LOCATION
Key for specifying the positioning of the legend using a DrawableConstants.Location value. |
static Settings.Key |
LEGEND_MARGIN
Key for specifying the Insets2D that
describes the legend's margin. |
static Settings.Key |
TITLE
Key for specifying the String instance for the title
of the plot. |
Constructor Summary | |
---|---|
Plot(DataSource... series)
Initializes a new Plot instance with the specified data
series. |
Method Summary | ||
---|---|---|
void |
add(DataSource source)
Adds a new data series to the plot which is visible by default. |
|
void |
add(DataSource source,
boolean visible)
Adds a new data series to the plot. |
|
void |
add(int index,
DataSource source,
boolean visible)
Inserts the specified data series to the plot at a specified position. |
|
void |
clear()
Removes all data series from this plot. |
|
boolean |
contains(DataSource source)
Returns whether the plot contains the specified data series. |
|
void |
dataChanged(DataSource data)
Method that is invoked by objects that provide support for DataListeners. |
|
void |
draw(DrawingContext context)
Draws the Drawable with the specified
Graphics2D object. |
|
DataSource |
get(int index)
Returns the data series at a specified index. |
|
Collection<Axis> |
getAxes()
Returns a Collection of all axes stored in this plot. |
|
Axis |
getAxis(String name)
Returns the axis with the specified name. |
|
AxisRenderer |
getAxisRenderer(Axis axis)
Returns the renderer for the specified axis. |
|
AxisRenderer |
getAxisRenderer(String axisName)
Returns the renderer for the axis with the specified name. |
|
List<DataSource> |
getData()
Returns a list of all data series stored in the plot. |
|
Legend |
getLegend()
Returns the legend. |
|
PlotArea |
getPlotArea()
Returns the drawing area of this plot. |
|
|
getSetting(Settings.Key key)
Returns the setting with the specified key. |
|
Label |
getTitle()
Returns the title of this plot. |
|
List<DataSource> |
getVisibleData()
Returns a list of all visible data series stored in the plot. |
|
boolean |
isVisible(DataSource source)
Returns whether the specified data series is drawn. |
|
void |
refresh()
Causes the plot data to be be updated. |
|
boolean |
remove(DataSource source)
Deletes the specified data series from the plot. |
|
void |
removeAxis(String name)
Removes the axis with the specified name. |
|
|
removeSetting(Settings.Key key)
Removes the setting with the specified key. |
|
|
removeSettingDefault(Settings.Key key)
Removes the default setting with the specified key. |
|
void |
setAxis(String name,
Axis axis)
Sets the axis with the specified name and the associated AxisRenderer . |
|
void |
setAxisRenderer(Axis axis,
AxisRenderer renderer)
Sets the renderer for the specified axis. |
|
void |
setAxisRenderer(String axisName,
AxisRenderer renderer)
Sets the renderer for the axis with the specified name. |
|
|
setSetting(Settings.Key key,
T value)
Sets the setting with the specified key to the specified value. |
|
|
setSettingDefault(Settings.Key key,
T value)
Sets a default value for the setting with the specified key. |
|
void |
settingChanged(SettingChangeEvent event)
Invoked if a setting has changed. |
|
void |
setVisible(DataSource source,
boolean visible)
Changes the visibility of the specified data series. |
Methods inherited from class de.erichseifert.gral.DrawableContainer |
---|
add, add, getConstraints, getInsets, getLayout, getPreferredSize, iterator, remove, setBounds, setBounds, setInsets, setLayout, size |
Methods inherited from class de.erichseifert.gral.AbstractDrawable |
---|
getBounds, getHeight, getWidth, getX, getY |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface de.erichseifert.gral.Container |
---|
getBounds |
Field Detail |
---|
public static final Settings.Key TITLE
String
instance for the title
of the plot.
public static final Settings.Key BACKGROUND
Paint
instance to be used to
paint the background of the plot.
public static final Settings.Key BORDER
Stroke
instance to be used to
paint the border of the plot.
public static final Settings.Key COLOR
Paint
instance to be used to
fill the border of the plot.
public static final Settings.Key ANTIALISING
public static final Settings.Key LEGEND
public static final Settings.Key LEGEND_LOCATION
DrawableConstants.Location
value.
public static final Settings.Key LEGEND_MARGIN
Insets2D
that
describes the legend's margin.
Constructor Detail |
---|
public Plot(DataSource... series)
Plot
instance with the specified data
series. The series will be visible by default.
series
- Initial data series to be displayed.Method Detail |
---|
public void draw(DrawingContext context)
Drawable
Drawable
with the specified
Graphics2D
object.
draw
in interface Drawable
draw
in class DrawableContainer
context
- Environment used for drawingpublic Axis getAxis(String name)
name
- Name of the axis.
public void setAxis(String name, Axis axis)
AxisRenderer
.
name
- Name of the axis.axis
- Axis.public void removeAxis(String name)
name
- Name of the axis to be removed.public Collection<Axis> getAxes()
public AxisRenderer getAxisRenderer(Axis axis)
axis
- Axis.
public AxisRenderer getAxisRenderer(String axisName)
axisName
- Axis name.
public void setAxisRenderer(Axis axis, AxisRenderer renderer)
axis
- Axis to be rendered.renderer
- Instance to render the axis.public void setAxisRenderer(String axisName, AxisRenderer renderer)
axisName
- Name of the axis to be rendered.renderer
- Instance to render the axis.public PlotArea getPlotArea()
PlotArea2D
.public Label getTitle()
public Legend getLegend()
public <T> T getSetting(Settings.Key key)
SettingsStorage
getSetting
in interface SettingsStorage
T
- Type of setting.key
- Key.
public <T> void setSetting(Settings.Key key, T value)
SettingsStorage
setSetting
in interface SettingsStorage
T
- Type of setting.key
- Key.value
- Value to be set.public <T> void removeSetting(Settings.Key key)
SettingsStorage
removeSetting
in interface SettingsStorage
T
- Type of setting.key
- Key.public <T> void setSettingDefault(Settings.Key key, T value)
SettingsStorage
setSettingDefault
in interface SettingsStorage
T
- Type of setting.key
- Key.value
- Value to be set.public <T> void removeSettingDefault(Settings.Key key)
SettingsStorage
removeSettingDefault
in interface SettingsStorage
T
- Type of setting.key
- Key.public void settingChanged(SettingChangeEvent event)
SettingsListener
settingChanged
in interface SettingsListener
event
- Event containing information about the changed setting.public void add(DataSource source)
source
- Data series.public void add(DataSource source, boolean visible)
source
- Data series.visible
- true
if the series should be displayed, false
otherwise.public void add(int index, DataSource source, boolean visible)
index
- Position.source
- Data series.visible
- true
if the series should be displayed, false
otherwise.public boolean contains(DataSource source)
source
- Data series.
true
if the specified element is stored in the plot, otherwise false
public DataSource get(int index)
index
- Position of the data series.
public boolean remove(DataSource source)
source
- Data series.
true
if the series existed, otherwise false
.public void clear()
public List<DataSource> getData()
public List<DataSource> getVisibleData()
public boolean isVisible(DataSource source)
source
- Data series.
true
if visible, false
otherwise.public void setVisible(DataSource source, boolean visible)
source
- Data series.visible
- true
if the series should be visible, false
otherwise.public void dataChanged(DataSource data)
DataListener
dataChanged
in interface DataListener
data
- data that has changedpublic void refresh()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |