public interface Plot extends Drawable, Container, SettingsStorage
Interface for classes that display data in a plot.
Functionality includes:
Modifier and Type | Field and Description |
---|---|
static Key |
BACKGROUND
Key for specifying the
Paint instance to be used to
paint the background of the plot. |
static Key |
BORDER
Key for specifying the
Stroke instance to be used to
paint the border of the plot. |
static Key |
COLOR
Key for specifying the
Paint instance to be used to
fill the border of the plot. |
static Key |
LEGEND
Key for specifying a
Boolean value to set whether the legend
should be shown. |
static Key |
LEGEND_DISTANCE
Key for specifying a
Number value that defines the spacing
between the plot area and the legend. |
static Key |
LEGEND_LOCATION
Key for specifying a
Location value for
the positioning of the legend. |
static Key |
TITLE
Key for specifying the
String instance for the title of the
plot. |
static Key |
TITLE_FONT
Key for specifying the
Font instance that is used to
display the title of the plot. |
Modifier and Type | Method and Description |
---|---|
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 |
autoscaleAxis(String axisName)
Tries to automatically set the ranges of the axes specified by the name
if it is set to auto-scale.
|
void |
clear()
Removes all data series from this plot.
|
boolean |
contains(DataSource source)
Returns whether the plot contains the specified data series.
|
DataSource |
get(int index)
Returns the data series at a specified index.
|
Collection<String> |
getAxesNames()
Returns a collection of all names of the axes stored in this plot.
|
Axis |
getAxis(String name)
Returns the axis with the specified name.
|
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 component.
|
String[] |
getMapping(DataSource source)
Returns the mapping of data source columns to axis names.
|
PlotArea |
getPlotArea()
Returns the drawing area of this plot.
|
Label |
getTitle()
Returns the title component 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.
|
boolean |
remove(DataSource source)
Deletes the specified data series from the plot.
|
void |
removeAxis(String name)
Removes the axis with the specified name.
|
void |
setAxis(String name,
Axis axis)
Sets the axis with the specified name and the associated
AxisRenderer . |
void |
setAxisRenderer(String axisName,
AxisRenderer renderer)
Sets the renderer for the axis with the specified name.
|
void |
setMapping(DataSource source,
String... axisNames)
Sets the mapping of data source columns to axis names.
|
void |
setVisible(DataSource source,
boolean visible)
Changes the visibility of the specified data series.
|
draw, getBounds, getHeight, getPreferredSize, getWidth, getX, getY, setBounds, setBounds
add, add, getBounds, getConstraints, getDrawableAt, getInsets, getLayout, layout, remove, setBounds, setInsets, setLayout, size
getSetting, removeSetting, removeSettingDefault, setSetting, setSettingDefault
static final Key TITLE_FONT
Font
instance that is used to
display the title of the plot.static final Key BACKGROUND
Paint
instance to be used to
paint the background of the plot.static final Key BORDER
Stroke
instance to be used to
paint the border of the plot.static final Key COLOR
Paint
instance to be used to
fill the border of the plot.static final Key LEGEND
Boolean
value to set whether the legend
should be shown.static final Key LEGEND_LOCATION
Location
value for
the positioning of the legend.Axis getAxis(String name)
name
- Name of the axis.void setAxis(String name, Axis axis)
AxisRenderer
.name
- Name of the axis.axis
- Axis.void removeAxis(String name)
name
- Name of the axis to be removed.Collection<String> getAxesNames()
void autoscaleAxis(String axisName)
axisName
- Name of the axis that should be scaled.Axis.setAutoscaled(boolean)
AxisRenderer getAxisRenderer(String axisName)
axisName
- Axis name.void setAxisRenderer(String axisName, AxisRenderer renderer)
axisName
- Name of the axis to be rendered.renderer
- Instance to render the axis.PlotArea getPlotArea()
PlotArea2D
.Label getTitle()
Legend getLegend()
void add(DataSource source)
source
- Data series.void add(DataSource source, boolean visible)
source
- Data series.visible
- true
if the series should be displayed,
false
otherwise.void add(int index, DataSource source, boolean visible)
index
- Position.source
- Data series.visible
- true
if the series should be displayed,
false
otherwise.boolean contains(DataSource source)
source
- Data series.true
if the specified element is stored in the
plot, otherwise false
DataSource get(int index)
index
- Position of the data series.boolean remove(DataSource source)
source
- Data series.true
if the series existed,
otherwise false
.void clear()
String[] getMapping(DataSource source)
source
. If no mapping exists
null
will be stored in the array.source
- Data source.null
if no mapping exists for the column.void setMapping(DataSource source, String... axisNames)
source
will be mapped to first element of axisNames
.
Axis names with value null
will be ignored.source
- Data source.axisNames
- Sequence of axis names in the order of the columns.List<DataSource> getData()
List<DataSource> getVisibleData()
boolean isVisible(DataSource source)
source
- Data series.true
if visible, false
otherwise.void setVisible(DataSource source, boolean visible)
source
- Data series.visible
- true
if the series should be visible,
false
otherwise.Copyright © 2009-2013. All Rights Reserved.