public interface Plot extends Drawable, Container
Interface for classes that display data in a plot.
Functionality includes:
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(java.lang.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.
|
java.util.Collection<java.lang.String> |
getAxesNames()
Returns a collection of all names of the axes stored in this plot.
|
Axis |
getAxis(java.lang.String name)
Returns the axis with the specified name.
|
AxisRenderer |
getAxisRenderer(java.lang.String axisName)
Returns the renderer for the axis with the specified name.
|
java.awt.Paint |
getBackground()
Returns the paint which is used to fill the background of the plot.
|
java.awt.Paint |
getBorderColor()
Returns the paint which is used to fill the border of the plot.
|
java.awt.Stroke |
getBorderStroke()
Returns the stroke which is used to paint the border of the plot.
|
java.util.List<DataSource> |
getData()
Returns a list of all data series stored in the plot.
|
Legend |
getLegend()
Returns the legend component.
|
double |
getLegendDistance()
Returns the spacing between the plot area and the legend.
|
Location |
getLegendLocation()
Returns the current positioning of the legend inside the plot.
|
java.lang.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.
|
java.util.List<DataSource> |
getVisibleData()
Returns a list of all visible data series stored in the plot.
|
boolean |
isLegendVisible()
Returns whether the legend is shown.
|
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(java.lang.String name)
Removes the axis with the specified name.
|
void |
setAxis(java.lang.String name,
Axis axis)
Sets the axis with the specified name and the associated
AxisRenderer . |
void |
setAxisRenderer(java.lang.String axisName,
AxisRenderer renderer)
Sets the renderer for the axis with the specified name.
|
void |
setBackground(java.awt.Paint background)
Sets the paint which will be used to fill the background of the plot.
|
void |
setBorderColor(java.awt.Paint color)
Sets the paint which will be used to fill the border of the plot.
|
void |
setBorderStroke(java.awt.Stroke border)
Sets the stroke which will be used to paint the border of the plot.
|
void |
setLegendDistance(double distance)
Sets the spacing between the plot area and the legend.
|
void |
setLegendLocation(Location location)
Sets the positioning of the legend inside the plot.
|
void |
setLegendVisible(boolean legendVisible)
Sets whether the legend will be shown.
|
void |
setMapping(DataSource source,
java.lang.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
Axis getAxis(java.lang.String name)
name
- Name of the axis.void setAxis(java.lang.String name, Axis axis)
AxisRenderer
.name
- Name of the axis.axis
- Axis.void removeAxis(java.lang.String name)
name
- Name of the axis to be removed.java.util.Collection<java.lang.String> getAxesNames()
void autoscaleAxis(java.lang.String axisName)
axisName
- Name of the axis that should be scaled.Axis.setAutoscaled(boolean)
AxisRenderer getAxisRenderer(java.lang.String axisName)
axisName
- Axis name.void setAxisRenderer(java.lang.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()
java.lang.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, java.lang.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.java.util.List<DataSource> getData()
java.util.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.java.awt.Paint getBackground()
void setBackground(java.awt.Paint background)
background
- Paint which will be used to fill the background of the
plot.java.awt.Stroke getBorderStroke()
void setBorderStroke(java.awt.Stroke border)
border
- Stroke which will be used to paint the border of the plot.java.awt.Paint getBorderColor()
void setBorderColor(java.awt.Paint color)
color
- Paint which will be used to fill the border of the plot.boolean isLegendVisible()
true
if the legend is shown,
false
if the legend is hidden.void setLegendVisible(boolean legendVisible)
legendVisible
- true
if the legend should be shown,
false
if the legend should be hidden.Location getLegendLocation()
void setLegendLocation(Location location)
location
- Positioning of the legend inside the plot.double getLegendDistance()
void setLegendDistance(double distance)
distance
- Spacing between the plot area and the legend relative to font
height.