Package org.opentrafficsim.draw.graphs
Class AbstractBoundedPlot
- java.lang.Object
-
- org.opentrafficsim.draw.graphs.AbstractPlot
-
- org.opentrafficsim.draw.graphs.AbstractBoundedPlot
-
- All Implemented Interfaces:
Dataset,Identifiable
- Direct Known Subclasses:
AbstractSpaceTimePlot,FundamentalDiagram
public abstract class AbstractBoundedPlot extends AbstractPlot
Plot that allows hard bounds to be set, with upper and lower bound independent. Manual zooming and auto ranges are bounded within the bounds.Copyright (c) 2013-2022 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.- Version:
- $Revision$, $LastChangedDate$, by $Author$, initial version 21 okt. 2018
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
-
-
Field Summary
-
Fields inherited from class org.opentrafficsim.draw.graphs.AbstractPlot
DEFAULT_INITIAL_UPPER_TIME_BOUND, GRAPH_ADD_EVENT, GRAPH_REMOVE_EVENT
-
-
Constructor Summary
Constructors Constructor Description AbstractBoundedPlot(OTSSimulatorInterface simulator, String caption, Duration updateInterval, Duration delay)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidsetAutoBoundDomain(XYPlot plot)Overridable; activates auto bounds on domain axis from user input.voidsetAutoBoundRange(XYPlot plot)Overridable; activates auto bounds on range axis from user input.protected voidsetChart(JFreeChart chart)Sets the chart and adds menus and listeners.voidsetLowerDomainBound(Double bound)Sets the lower domain bound.voidsetLowerRangeBound(Double bound)Sets the lower range bound.voidsetUpperDomainBound(Double bound)Sets the upper domain bound.voidsetUpperRangeBound(Double bound)Sets the upper range bound.-
Methods inherited from class org.opentrafficsim.draw.graphs.AbstractPlot
addChangeListener, encodeAsPng, getCaption, getChart, getGraphType, getGroup, getId, getSimulator, getStatusLabel, getUpdateTime, increaseTime, notifyPlotChange, removeChangeListener, setGroup, setUpdateInterval, update
-
-
-
-
Constructor Detail
-
AbstractBoundedPlot
public AbstractBoundedPlot(OTSSimulatorInterface simulator, String caption, Duration updateInterval, Duration delay)
Constructor.- Parameters:
simulator- OTSSimulatorInterface; simulatorcaption- String; captionupdateInterval- Duration; regular update interval (simulation time)delay- Duration; amount of time that chart runs behind simulation to prevent gaps in the charted data
-
-
Method Detail
-
setChart
protected void setChart(JFreeChart chart)
Sets the chart and adds menus and listeners.- Overrides:
setChartin classAbstractPlot- Parameters:
chart- JFreeChart; chart
-
setLowerDomainBound
public void setLowerDomainBound(Double bound)
Sets the lower domain bound.- Parameters:
bound- Double; usenullto disable bound
-
setUpperDomainBound
public void setUpperDomainBound(Double bound)
Sets the upper domain bound.- Parameters:
bound- Double; usenullto disable bound
-
setLowerRangeBound
public void setLowerRangeBound(Double bound)
Sets the lower range bound.- Parameters:
bound- Double; usenullto disable bound
-
setUpperRangeBound
public void setUpperRangeBound(Double bound)
Sets the upper range bound.- Parameters:
bound- Double; usenullto disable bound
-
setAutoBoundDomain
public void setAutoBoundDomain(XYPlot plot)
Overridable; activates auto bounds on domain axis from user input. This class does not force the use ofXYPlots, but the auto bounds command comes from theChartPanelthat this class creates. In case the used plot is aXYPlot, this method is then invoked. Sub classes with auto domain bounds that work with anXYPlotshould implement this. The method is not abstract as the use ofXYPlotis not obligated.- Overrides:
setAutoBoundDomainin classAbstractPlot- Parameters:
plot- XYPlot; plot
-
setAutoBoundRange
public void setAutoBoundRange(XYPlot plot)
Overridable; activates auto bounds on range axis from user input. This class does not force the use ofXYPlots, but the auto bounds command comes from theChartPanelthat this class creates. In case the used plot is aXYPlot, this method is then invoked. Sub classes with auto range bounds that work with anXYPlotshould implement this. The method is not abstract as the use ofXYPlotis not obligated.- Overrides:
setAutoBoundRangein classAbstractPlot- Parameters:
plot- XYPlot; plot
-
-