de.erichseifert.gral.plots
Interface Plot
-
- All Known Implementing Classes:
- AbstractPlot, BarPlot, BoxPlot, PiePlot, RasterPlot, XYPlot
public interface Plot extends Drawable, Container
Interface for classes that display data in a plot.
Functionality includes:
- Adding axes to the plot
- Adding a title to the plot
- Adding a legend to the plot
- Administration of settings
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description voidadd(DataSource source)Adds a new data series to the plot which is visible by default.voidadd(DataSource source, boolean visible)Adds a new data series to the plot.voidadd(int index, DataSource source, boolean visible)Inserts the specified data series to the plot at a specified position.voidautoscaleAxis(java.lang.String axisName)Tries to automatically set the ranges of the axes specified by the name if it is set to auto-scale.voidclear()Removes all data series from this plot.booleancontains(DataSource source)Returns whether the plot contains the specified data series.DataSourceget(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.AxisgetAxis(java.lang.String name)Returns the axis with the specified name.AxisRenderergetAxisRenderer(java.lang.String axisName)Returns the renderer for the axis with the specified name.java.awt.PaintgetBackground()Returns the paint which is used to fill the background of the plot.java.awt.PaintgetBorderColor()Returns the paint which is used to fill the border of the plot.java.awt.StrokegetBorderStroke()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.java.awt.FontgetFont()Returns the base font used by the plot.LegendgetLegend()Returns the legend component.doublegetLegendDistance()Returns the spacing between the plot area and the legend.LocationgetLegendLocation()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.PlotAreagetPlotArea()Returns the drawing area of this plot.LabelgetTitle()Returns the title component of this plot.java.util.List<DataSource>getVisibleData()Returns a list of all visible data series stored in the plot.booleanisLegendVisible()Returns whether the legend is shown.booleanisVisible(DataSource source)Returns whether the specified data series is drawn.booleanremove(DataSource source)Deletes the specified data series from the plot.voidremoveAxis(java.lang.String name)Removes the axis with the specified name.voidsetAxis(java.lang.String name, Axis axis)Sets the axis with the specified name and the associatedAxisRenderer.voidsetAxisRenderer(java.lang.String axisName, AxisRenderer renderer)Sets the renderer for the axis with the specified name.voidsetBackground(java.awt.Paint background)Sets the paint which will be used to fill the background of the plot.voidsetBorderColor(java.awt.Paint color)Sets the paint which will be used to fill the border of the plot.voidsetBorderStroke(java.awt.Stroke border)Sets the stroke which will be used to paint the border of the plot.voidsetFont(java.awt.Font font)Sets the base font that will be used by the plot.voidsetLegendDistance(double distance)Sets the spacing between the plot area and the legend.voidsetLegendLocation(Location location)Sets the positioning of the legend inside the plot.voidsetLegendVisible(boolean legendVisible)Sets whether the legend will be shown.voidsetMapping(DataSource source, java.lang.String... axisNames)Sets the mapping of data source columns to axis names.voidsetVisible(DataSource source, boolean visible)Changes the visibility of the specified data series.-
Methods inherited from interface de.erichseifert.gral.graphics.Drawable
draw, getBounds, getHeight, getPreferredSize, getWidth, getX, getY, setBounds, setBounds, setPosition
-
-
-
-
Method Detail
-
getAxis
Axis getAxis(java.lang.String name)
Returns the axis with the specified name.- Parameters:
name- Name of the axis.- Returns:
- Axis.
-
setAxis
void setAxis(java.lang.String name, Axis axis)Sets the axis with the specified name and the associatedAxisRenderer.- Parameters:
name- Name of the axis.axis- Axis.
-
removeAxis
void removeAxis(java.lang.String name)
Removes the axis with the specified name.- Parameters:
name- Name of the axis to be removed.
-
getAxesNames
java.util.Collection<java.lang.String> getAxesNames()
Returns a collection of all names of the axes stored in this plot.- Returns:
- The names of all axes stored in this plot.
-
autoscaleAxis
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.- Parameters:
axisName- Name of the axis that should be scaled.- See Also:
Axis.setAutoscaled(boolean)
-
getAxisRenderer
AxisRenderer getAxisRenderer(java.lang.String axisName)
Returns the renderer for the axis with the specified name.- Parameters:
axisName- Axis name.- Returns:
- Instance that renders the axis.
-
setAxisRenderer
void setAxisRenderer(java.lang.String axisName, AxisRenderer renderer)Sets the renderer for the axis with the specified name.- Parameters:
axisName- Name of the axis to be rendered.renderer- Instance to render the axis.
-
getPlotArea
PlotArea getPlotArea()
Returns the drawing area of this plot.- Returns:
PlotArea2D.
-
getTitle
Label getTitle()
Returns the title component of this plot.- Returns:
- Label representing the title.
-
getLegend
Legend getLegend()
Returns the legend component.- Returns:
- Legend.
-
add
void add(DataSource source)
Adds a new data series to the plot which is visible by default.- Parameters:
source- Data series.
-
add
void add(DataSource source, boolean visible)
Adds a new data series to the plot.- Parameters:
source- Data series.visible-trueif the series should be displayed,falseotherwise.
-
add
void add(int index, DataSource source, boolean visible)Inserts the specified data series to the plot at a specified position.- Parameters:
index- Position.source- Data series.visible-trueif the series should be displayed,falseotherwise.
-
contains
boolean contains(DataSource source)
Returns whether the plot contains the specified data series.- Parameters:
source- Data series.- Returns:
trueif the specified element is stored in the plot, otherwisefalse
-
get
DataSource get(int index)
Returns the data series at a specified index.- Parameters:
index- Position of the data series.- Returns:
- Instance of the data series.
-
remove
boolean remove(DataSource source)
Deletes the specified data series from the plot.- Parameters:
source- Data series.- Returns:
trueif the series existed, otherwisefalse.
-
clear
void clear()
Removes all data series from this plot.
-
getMapping
java.lang.String[] getMapping(DataSource source)
Returns the mapping of data source columns to axis names. The elements of returned array equal the column indexes, i.e. the first element (axis name) matches the first column ofsource. If no mapping existsnullwill be stored in the array.- Parameters:
source- Data source.- Returns:
- Array containing axis names in the order of the columns,
or
nullif no mapping exists for the column.
-
setMapping
void setMapping(DataSource source, java.lang.String... axisNames)
Sets the mapping of data source columns to axis names. The column index is taken from the order of the axis names, i.e. the first column ofsourcewill be mapped to first element ofaxisNames. Axis names with valuenullwill be ignored.- Parameters:
source- Data source.axisNames- Sequence of axis names in the order of the columns.
-
getData
java.util.List<DataSource> getData()
Returns a list of all data series stored in the plot.- Returns:
- List of all data series.
-
getVisibleData
java.util.List<DataSource> getVisibleData()
Returns a list of all visible data series stored in the plot.- Returns:
- List of all visible data series.
-
isVisible
boolean isVisible(DataSource source)
Returns whether the specified data series is drawn.- Parameters:
source- Data series.- Returns:
trueif visible,falseotherwise.
-
setVisible
void setVisible(DataSource source, boolean visible)
Changes the visibility of the specified data series.- Parameters:
source- Data series.visible-trueif the series should be visible,falseotherwise.
-
getBackground
java.awt.Paint getBackground()
Returns the paint which is used to fill the background of the plot.- Returns:
- Paint which is used to fill the background of the plot.
-
setBackground
void setBackground(java.awt.Paint background)
Sets the paint which will be used to fill the background of the plot.- Parameters:
background- Paint which will be used to fill the background of the plot.
-
getBorderStroke
java.awt.Stroke getBorderStroke()
Returns the stroke which is used to paint the border of the plot.- Returns:
- Stroke which is used to paint the border of the plot.
-
setBorderStroke
void setBorderStroke(java.awt.Stroke border)
Sets the stroke which will be used to paint the border of the plot.- Parameters:
border- Stroke which will be used to paint the border of the plot.
-
getBorderColor
java.awt.Paint getBorderColor()
Returns the paint which is used to fill the border of the plot.- Returns:
- Paint which is used to fill the border of the plot.
-
setBorderColor
void setBorderColor(java.awt.Paint color)
Sets the paint which will be used to fill the border of the plot.- Parameters:
color- Paint which will be used to fill the border of the plot.
-
getFont
java.awt.Font getFont()
Returns the base font used by the plot.- Returns:
- Font used by the plot.
-
setFont
void setFont(java.awt.Font font)
Sets the base font that will be used by the plot.- Parameters:
font- Font that will used by the plot.
-
isLegendVisible
boolean isLegendVisible()
Returns whether the legend is shown.- Returns:
trueif the legend is shown,falseif the legend is hidden.
-
setLegendVisible
void setLegendVisible(boolean legendVisible)
Sets whether the legend will be shown.- Parameters:
legendVisible-trueif the legend should be shown,falseif the legend should be hidden.
-
getLegendLocation
Location getLegendLocation()
Returns the current positioning of the legend inside the plot.- Returns:
- Current positioning of the legend inside the plot.
-
setLegendLocation
void setLegendLocation(Location location)
Sets the positioning of the legend inside the plot.- Parameters:
location- Positioning of the legend inside the plot.
-
getLegendDistance
double getLegendDistance()
Returns the spacing between the plot area and the legend.- Returns:
- Spacing between the plot area and the legend relative to font height.
-
setLegendDistance
void setLegendDistance(double distance)
Sets the spacing between the plot area and the legend. The distance is defined in font height.- Parameters:
distance- Spacing between the plot area and the legend relative to font height.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG