org.jplot2d.element
Interface Plot
-
- All Superinterfaces:
- Element, PComponent
- All Known Subinterfaces:
- PlotEx
- All Known Implementing Classes:
- PlotImpl
public interface Plot extends PComponent
Plot has a content area in the center, surrounded by margin area. The margin area holds axes, titles and legend.Plot can contains a group of layers that stack over each other, their viewports have the same bounds of the content area.
Plot can also contains a group of subplots, which are laid out by LayoutDirector.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description voidadaptiveZoomX()Adaptive zoom the x range for all axes in this plot.voidadaptiveZoomY()Adaptive zoom the y range for all axes in this plot.voidaddLayer(Layer layer)Add a layer to this plot.voidaddLayer(Layer layer, Axis xaxis, Axis yaxis)Add a layer to this plot.voidaddLayer(Layer layer, AxisTransform xRangeManager, AxisTransform yRangeManager)Add a layer to this plot.voidaddSubplot(Plot subplot, java.lang.Object constraint)Add a subplot with a constraint to this plot.voidaddTitle(Title title)voidaddXAxes(Axis[] axes)Add the given axes created byElementFactory.createAxes(int)as x-axesvoidaddXAxis(Axis axis)voidaddYAxes(Axis[] axes)Add the given axes created byElementFactory.createAxes(int)as y-axesvoidaddYAxis(Axis axis)java.lang.ObjectgetConstraint(Plot subplot)Returns the constraint of the specified subplot in the current LayoutManager.java.awt.geom.Dimension2DgetContainerSize()Returns the container size in device coordinate system.java.awt.geom.Dimension2DgetContentSize()Returns the size of content area.LayergetLayer(int index)Gets the nth layer in this plot.Layer[]getLayers()Returns all layers in the order of added.LayoutDirectorgetLayoutDirector()Gets the layout director for this plot.LegendgetLegend()Returns the legend of this plot.java.awt.geom.Point2DgetLocation()Gets the location of this plot in its parent plot.PlotMargingetMargin()Returns the margin area of this plot.PlotgetParent()Gets the parent of this component.java.awt.geom.Dimension2DgetPreferredContentSize()Returns the the preferred content area size.doublegetScale()Returns the scale of this plot.SizeModegetSizeMode()Returns the size mode of this plot.PlotgetSubplot(int n)Gets the nth subplot in this plot.Plot[]getSubplots()Gets the nth subplot in this plot.TitlegetTitle(int index)Gets the nth title in this plot.Title[]getTitles()Returns all titles in the order of added.Axis[]getXAxes()AxisgetXAxis(int index)Axis[]getYAxes()AxisgetYAxis(int index)voidremoveLayer(Layer layer)voidremoveSubplot(Plot subplot)remove the specified subplot from this plot.voidremoveTitle(Title title)voidremoveXAxis(Axis axis)Removes the specified X axis from this plot if it is present.voidremoveYAxis(Axis axis)Removes the specified Y axis from this plot if it is present.voidsetConstraint(Plot subplot, java.lang.Object constraint)Sets the constraint of the specified subplot in the current LayoutManager.voidsetContainerSize(java.awt.geom.Dimension2D size)Sets the container size.voidsetLayoutDirector(LayoutDirector director)Sets the layout director for this plot.voidsetLocation(double locX, double locY)voidsetLocation(java.awt.geom.Point2D loc)Moves this plot to a new location.voidsetPreferredContentSize(java.awt.geom.Dimension2D size)Sets the preferred content area sizevoidsetPreferredContentSize(double width, double height)Sets the preferred content area sizevoidsetScale(double scale)Sets scale of this plot.voidsetSize(java.awt.geom.Dimension2D size)Sets the paper size of this plot.voidsetSize(double width, double height)Sets the paper size of this plot.voidsetSizeMode(SizeMode mode)Sets a size mode to manage the size and scale of this plot according to its container size.voidsetSubplotConstraint(Plot subplot, java.lang.Object constraint)Set a new layout constraint for the given subplot.voidzoomXRange(double start, double end)Zoom the given range to entire X axis.voidzoomYRange(double start, double end)Zoom the given range to entire Y axis.-
Methods inherited from interface org.jplot2d.element.PComponent
getBounds, getColor, getEffectiveFont, getFontName, getFontScale, getFontSize, getFontStyle, getPaperTransform, getSelectableBounds, getSize, getZOrder, isCacheable, isSelectable, isVisible, setCacheable, setColor, setFont, setFontName, setFontScale, setFontSize, setFontStyle, setSelectable, setVisible, setZOrder
-
Methods inherited from interface org.jplot2d.element.Element
getEnvironment, getId
-
-
-
-
Method Detail
-
getParent
Plot getParent()
Description copied from interface:PComponentGets the parent of this component.- Specified by:
getParentin interfaceElement- Specified by:
getParentin interfacePComponent- Returns:
- the parent of this component
-
getSizeMode
SizeMode getSizeMode()
Returns the size mode of this plot.- Returns:
-
setSizeMode
void setSizeMode(SizeMode mode)
Sets a size mode to manage the size and scale of this plot according to its container size. The mode must be set when displaying a plot in a swing/swt component.- Parameters:
mode-
-
getContainerSize
java.awt.geom.Dimension2D getContainerSize()
Returns the container size in device coordinate system.- Returns:
- the container size
-
setContainerSize
void setContainerSize(java.awt.geom.Dimension2D size)
Sets the container size. The container size is given in device coordinate system and used by size mode to derive paper size and scale. The default value is 640x480 pixels.If the size mode is
nullwhen calling this method, an IllegalStateException will be thrown.- Parameters:
size-
-
getScale
double getScale()
Returns the scale of this plot. The scale is ratio device size to paper size.- Returns:
- the scale of this plot
-
setScale
void setScale(double scale)
Sets scale of this plot. This method only take effect when size mode isnull. Otherwise the scale is decided by size mode.- Parameters:
scale- the scale
-
setSize
void setSize(java.awt.geom.Dimension2D size)
Sets the paper size of this plot. This method only take effect when size mode isnull. Otherwise the size is decided by size mode.- Parameters:
size- the paper size
-
setSize
void setSize(double width, double height)Sets the paper size of this plot. This method only take effect when size mode isnull. Otherwise the size is decided by size mode.For subplot, the size is set by layout manager.
- Parameters:
width- the paper widthheight- the paper height
-
getLayoutDirector
LayoutDirector getLayoutDirector()
Gets the layout director for this plot.- Returns:
- the layout director for this plot.
-
setLayoutDirector
void setLayoutDirector(LayoutDirector director)
Sets the layout director for this plot.- Parameters:
director- the layout director
-
getConstraint
java.lang.Object getConstraint(Plot subplot)
Returns the constraint of the specified subplot in the current LayoutManager.- Parameters:
subplot- The subplot whose constraint is being set- Returns:
- the constraint
- Throws:
java.lang.IllegalArgumentException- if the subplot is not contained by this plot
-
setConstraint
void setConstraint(Plot subplot, java.lang.Object constraint)
Sets the constraint of the specified subplot in the current LayoutManager.- Parameters:
subplot- The subplot whose constraint is being setconstraint- the constraint- Throws:
java.lang.IllegalArgumentException- if the subplot is not contained by this plot
-
getPreferredContentSize
java.awt.geom.Dimension2D getPreferredContentSize()
Returns the the preferred content area size.- Returns:
- the the preferred content area size
-
setPreferredContentSize
void setPreferredContentSize(java.awt.geom.Dimension2D size)
Sets the preferred content area size- Parameters:
size- the size in Dimension2D
-
setPreferredContentSize
void setPreferredContentSize(double width, double height)Sets the preferred content area size- Parameters:
width- the widthheight- the height
-
getLocation
java.awt.geom.Point2D getLocation()
Gets the location of this plot in its parent plot. The origin of a plot is the bottom-left corner of the content box (the intersect point of left axis and bottom axis). For root plot, the returned value is always (0,0)- Specified by:
getLocationin interfacePComponent- Returns:
- an instance of
Pointrepresenting the base point of this plot
-
setLocation
void setLocation(java.awt.geom.Point2D loc)
Moves this plot to a new location. The new location is specified by point and is given in the parent's paper coordinate space.Notice: This method should be called when the parent plot's layout director does not manage subplots, such as
SimpleLayoutDirector, otherwise the location will be overwrite by the layout director.For root plot, this method has no effect.
- Parameters:
p- the point defining the origin of the new location
-
setLocation
void setLocation(double locX, double locY)
-
getContentSize
java.awt.geom.Dimension2D getContentSize()
Returns the size of content area.- Returns:
- the size of content area.
-
getMargin
PlotMargin getMargin()
Returns the margin area of this plot.- Returns:
-
getLegend
Legend getLegend()
Returns the legend of this plot.- Returns:
- the legend of this plot
-
getTitle
Title getTitle(int index)
Gets the nth title in this plot.- Parameters:
n- the index of the title to get.- Returns:
- the nth title in this plot
-
getTitles
Title[] getTitles()
Returns all titles in the order of added.- Returns:
- all titles
-
addTitle
void addTitle(Title title)
-
removeTitle
void removeTitle(Title title)
-
getXAxis
Axis getXAxis(int index)
-
getYAxis
Axis getYAxis(int index)
-
getXAxes
Axis[] getXAxes()
-
getYAxes
Axis[] getYAxes()
-
addXAxis
void addXAxis(Axis axis)
-
addYAxis
void addYAxis(Axis axis)
-
addXAxes
void addXAxes(Axis[] axes)
Add the given axes created byElementFactory.createAxes(int)as x-axes- Parameters:
axes- the axes to be added
-
addYAxes
void addYAxes(Axis[] axes)
Add the given axes created byElementFactory.createAxes(int)as y-axes- Parameters:
axes- the axes to be added
-
removeXAxis
void removeXAxis(Axis axis)
Removes the specified X axis from this plot if it is present.- Parameters:
axis- the X axis to be removed
-
removeYAxis
void removeYAxis(Axis axis)
Removes the specified Y axis from this plot if it is present.- Parameters:
axis- the Y axis to be removed
-
getLayer
Layer getLayer(int index)
Gets the nth layer in this plot.- Parameters:
n- the index of the layer to get.- Returns:
- the nth layer in this plot
-
getLayers
Layer[] getLayers()
Returns all layers in the order of added.- Returns:
- all layers
-
addLayer
void addLayer(Layer layer)
Add a layer to this plot. The layer will not associate with any axis range manager. Before the layer associate axis transform byLayer.setAxesTransform(AxisTransform, AxisTransform), all its subcomponents are invisible.- Parameters:
layer- the layer to be added
-
addLayer
void addLayer(Layer layer, AxisTransform xRangeManager, AxisTransform yRangeManager)
Add a layer to this plot. The layer will associate with the given X/Y axis range manager to control which part show in the plot viewport.- Parameters:
layer- the layer to be addedxRangeManager- the x axis range manageryRangeManager- the y axis range manager
-
addLayer
void addLayer(Layer layer, Axis xaxis, Axis yaxis)
Add a layer to this plot. The layer will associate with the given X/Y axis' range manager to control which part show in the plot viewport. Equivalent toaddLayer(layer, xaxis.getTickManager().getRangeManager(), yaxis.getTickManager().getRangeManager())- Parameters:
layer- the layer to be addedxaxis- the x axisyaxis- the y axis
-
removeLayer
void removeLayer(Layer layer)
-
getSubplot
Plot getSubplot(int n)
Gets the nth subplot in this plot.- Parameters:
n- the index of the component to get.- Returns:
- the nth subplot in this subplot
-
getSubplots
Plot[] getSubplots()
Gets the nth subplot in this plot.- Parameters:
n- the index of the component to get.- Returns:
- the nth subplot in this plot
-
addSubplot
void addSubplot(Plot subplot, java.lang.Object constraint)
Add a subplot with a constraint to this plot.- Parameters:
subplot- the subplot to be addedconstraint- an object expressing layout constraints
-
removeSubplot
void removeSubplot(Plot subplot)
remove the specified subplot from this plot.- Parameters:
subplot-
-
setSubplotConstraint
void setSubplotConstraint(Plot subplot, java.lang.Object constraint)
Set a new layout constraint for the given subplot.- Parameters:
subplot- the subplotconstraint- an object expressing layout constraints
-
zoomXRange
void zoomXRange(double start, double end)Zoom the given range to entire X axis. The behavior is like, creating a temporary AxisRangeLockGroup to group all AxisRangeLockGroups which zoomable aretruein this plot, and zoom the range on it.- Parameters:
start- the normalized startend- the normalized end
-
zoomYRange
void zoomYRange(double start, double end)Zoom the given range to entire Y axis. The behavior is like, creating a temporary AxisRangeLockGroup to group all AxisRangeLockGroups which zoomable aretruein this plot, and zoom the range on it.- Parameters:
start- the normalized startend- the normalized end
-
adaptiveZoomX
void adaptiveZoomX()
Adaptive zoom the x range for all axes in this plot. Only axes whoes AxisRangeLockGroups is zoomable are zoomed.
-
adaptiveZoomY
void adaptiveZoomY()
Adaptive zoom the y range for all axes in this plot. Only axes whoes AxisRangeLockGroups is zoomable are zoomed.
-
-
DMelt 3.0 © DataMelt by jWork.ORG