Class XYChart
- java.lang.Object
-
- nl.tudelft.simulation.dsol.swing.charts.xy.XYChart
-
- All Implemented Interfaces:
Serializable,Swingable
public class XYChart extends Object implements Swingable, Serializable
The xyChart specifies the xyChart in DSOL.Copyright (c) 2002-2023 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://simulation.tudelft.nl. The DSOL project is distributed under a three-clause BSD-style license, which can be found at https://https://simulation.tudelft.nl/dsol/docs/latest/license.html.
- Author:
- Peter Jacobs
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected shortaxisTypethe axis type of the chart.protected JFreeChartchartchart refers to the chart.protected XYDatasetdatasetdataset refers to the dataset.(package private) SimulatorInterface<?>simulatorthe simulator.static shortXLINEAR_YLINEARx-axis is linear y-axis is linear.static shortXLINEAR_YLOGARITHMICx-axis is linear y-axis is logarithmic.static shortXLOGARITHMIC_YLINEARx-axis is logarithmic y-axis is linear.static shortXLOGARITHMIC_YLOGARITHMICx-axis is logarithmic y-axis is logarithmic.
-
Constructor Summary
Constructors Constructor Description XYChart(SimulatorInterface<?> simulator, String title)constructs a new XYChart that is registered in the simulator-provided jndi context.XYChart(SimulatorInterface<?> simulator, String title, double period)constructs a new XYChart that is registered in the simulator-provided jndi context.XYChart(SimulatorInterface<?> simulator, String title, double[] domain)constructs a new XYChart that is registered in the simulator-provided jndi context.XYChart(SimulatorInterface<?> simulator, String title, double[] domain, double[] range)constructs a new XYChart that is registered in the simulator-provided jndi context.XYChart(SimulatorInterface<?> simulator, String title, double[] domain, double[] range, short axisType)constructs a new XYChart and bind it to the replication context.XYChart(SimulatorInterface<?> simulator, String title, double[] domain, short axisType)constructs a new XYChart that is registered in the simulator-provided jndi context.XYChart(SimulatorInterface<?> simulator, String title, double period, double[] range)constructs a new XYChart that is registered in the simulator-provided jndi context.XYChart(SimulatorInterface<?> simulator, String title, double period, short axisType)constructs a new XYChart that is registered in the simulator-provided jndi context.XYChart(SimulatorInterface<?> simulator, String title, short axisType)constructs a new XYChart that is registered in the simulator-provided jndi context.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(String description, EventProducer source, EventType eventType)adds an eventProducer to the xyChart.voidadd(SimPersistent<?> persistent)adds a tally to the xyChart.JFreeChartgetChart()returns the chart.XYDatasetgetDataset()returns the dataset of a xyChart.ContainergetSwingPanel()represents this statisticsObject as Swing Container.voidsetFilter(nl.tudelft.simulation.language.filters.FilterInterface filter)applies a filter on the chart.XYChartsetLabelXAxis(String xLabel)Set the label for the X-axis of the XY plot.XYChartsetLabelYAxis(String yLabel)Set the label for the Y-axis of the XY plot.StringtoString()
-
-
-
Field Detail
-
XLINEAR_YLINEAR
public static final short XLINEAR_YLINEAR
x-axis is linear y-axis is linear.- See Also:
- Constant Field Values
-
XLINEAR_YLOGARITHMIC
public static final short XLINEAR_YLOGARITHMIC
x-axis is linear y-axis is logarithmic.- See Also:
- Constant Field Values
-
XLOGARITHMIC_YLINEAR
public static final short XLOGARITHMIC_YLINEAR
x-axis is logarithmic y-axis is linear.- See Also:
- Constant Field Values
-
XLOGARITHMIC_YLOGARITHMIC
public static final short XLOGARITHMIC_YLOGARITHMIC
x-axis is logarithmic y-axis is logarithmic.- See Also:
- Constant Field Values
-
chart
protected JFreeChart chart
chart refers to the chart.
-
simulator
final SimulatorInterface<?> simulator
the simulator.
-
dataset
protected XYDataset dataset
dataset refers to the dataset.
-
axisType
protected short axisType
the axis type of the chart.
-
-
Constructor Detail
-
XYChart
public XYChart(SimulatorInterface<?> simulator, String title, double[] domain, double[] range, short axisType)
constructs a new XYChart and bind it to the replication context.- Parameters:
simulator- SimulatorInterface; the simulatortitle- String; the titledomain- double[]; the domainrange- double[]; the rangeaxisType- short; the type of the axsis
-
XYChart
public XYChart(SimulatorInterface<?> simulator, String title)
constructs a new XYChart that is registered in the simulator-provided jndi context.- Parameters:
simulator- SimulatorInterface<?, ?, ?>; the simulatortitle- String; the title
-
XYChart
public XYChart(SimulatorInterface<?> simulator, String title, short axisType)
constructs a new XYChart that is registered in the simulator-provided jndi context.- Parameters:
simulator- SimulatorInterface<?, ?, ?>; the simulatortitle- String; the titleaxisType- short; the axisType to use.
-
XYChart
public XYChart(SimulatorInterface<?> simulator, String title, double[] domain)
constructs a new XYChart that is registered in the simulator-provided jndi context.- Parameters:
simulator- SimulatorInterface<?, ?, ?>; the simulatortitle- String; the titledomain- double[]; the domain
-
XYChart
public XYChart(SimulatorInterface<?> simulator, String title, double period)
constructs a new XYChart that is registered in the simulator-provided jndi context.- Parameters:
simulator- SimulatorInterface<?, ?, ?>; the simulatortitle- String; the titleperiod- double; the period
-
XYChart
public XYChart(SimulatorInterface<?> simulator, String title, double[] domain, short axisType)
constructs a new XYChart that is registered in the simulator-provided jndi context.- Parameters:
simulator- SimulatorInterface<?, ?, ?>; the simulatortitle- String; the titledomain- double[]; the domainaxisType- short; the axisType to use.
-
XYChart
public XYChart(SimulatorInterface<?> simulator, String title, double period, short axisType)
constructs a new XYChart that is registered in the simulator-provided jndi context.- Parameters:
simulator- SimulatorInterface<?, ?, ?>; the simulatortitle- String; the titleperiod- double; the periodaxisType- short; the axisType to use.
-
XYChart
public XYChart(SimulatorInterface<?> simulator, String title, double[] domain, double[] range)
constructs a new XYChart that is registered in the simulator-provided jndi context.- Parameters:
simulator- SimulatorInterface<?, ?, ?>; the simulatortitle- String; the titledomain- double[]; the domainrange- double[]; the range
-
XYChart
public XYChart(SimulatorInterface<?> simulator, String title, double period, double[] range)
constructs a new XYChart that is registered in the simulator-provided jndi context.- Parameters:
simulator- SimulatorInterface<?, ?, ?>; the simulatortitle- String; the titleperiod- double; the periodrange- double[]; the range
-
-
Method Detail
-
add
public void add(SimPersistent<?> persistent) throws RemoteException
adds a tally to the xyChart.- Parameters:
persistent- Persistent; the persistent- Throws:
RemoteException- on network failure
-
add
public void add(String description, EventProducer source, EventType eventType) throws RemoteException
adds an eventProducer to the xyChart.- Parameters:
description- String; the description of the eventProducersource- EventProducer; the sourceeventType- EventType; the event- Throws:
RemoteException- on network failure
-
setLabelXAxis
public XYChart setLabelXAxis(String xLabel)
Set the label for the X-axis of the XY plot.- Parameters:
xLabel- String; the new label for the X axis- Returns:
- the chart for method chaining
-
setLabelYAxis
public XYChart setLabelYAxis(String yLabel)
Set the label for the Y-axis of the XY plot.- Parameters:
yLabel- String; the new label for the X axis- Returns:
- the chart for method chaining
-
getChart
public JFreeChart getChart()
returns the chart.- Returns:
- JFreeChart
-
getSwingPanel
public Container getSwingPanel()
represents this statisticsObject as Swing Container.- Specified by:
getSwingPanelin interfaceSwingable- Returns:
- a Container representation of an object
-
getDataset
public XYDataset getDataset()
returns the dataset of a xyChart.- Returns:
- HistogramSeries
-
setFilter
public void setFilter(nl.tudelft.simulation.language.filters.FilterInterface filter)
applies a filter on the chart.- Parameters:
filter- FilterInterface; the filter to apply
-
-