package org.opentrafficsim.draw.graphs; import java.awt.Color; import java.time.Period; import java.util.ArrayList; import java.util.EnumSet; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; import org.djunits.value.vdouble.scalar.Duration; import org.djunits.value.vdouble.scalar.Length; import org.djunits.value.vdouble.scalar.Time; import org.djutils.exceptions.Throw; import org.djutils.immutablecollections.ImmutableLinkedHashSet; import org.djutils.immutablecollections.ImmutableSet; import org.jfree.chart.JFreeChart; import org.jfree.chart.LegendItem; import org.jfree.chart.LegendItemCollection; import org.jfree.chart.axis.NumberAxis; import org.jfree.chart.plot.XYPlot; import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; import org.jfree.data.DomainOrder; import org.jfree.data.xy.XYDataset; import org.opentrafficsim.core.dsol.OTSSimulatorInterface; import org.opentrafficsim.kpi.sampling.KpiLaneDirection; import org.opentrafficsim.kpi.sampling.Sampler; import org.opentrafficsim.kpi.sampling.SamplingException; import org.opentrafficsim.kpi.sampling.SpaceTimeRegion; import org.opentrafficsim.kpi.sampling.Trajectory; import org.opentrafficsim.kpi.sampling.Trajectory.SpaceTimeView; import org.opentrafficsim.kpi.sampling.TrajectoryGroup; /** * Fundamental diagram from various sources. *

* Copyright (c) 2013-2020 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 14 okt. 2018
* @author Alexander Verbraeck * @author Peter Knoppers * @author Wouter Schakel */ public class FundamentalDiagram extends AbstractBoundedPlot implements XYDataset { /** Aggregation periods. */ public static final double[] DEFAULT_PERIODS = new double[] {5.0, 10.0, 30.0, 60.0, 120.0, 300.0, 900.0}; /** Update frequencies (n * 1/period). */ public static final int[] DEFAULT_UPDATE_FREQUENCIES = new int[] {1, 2, 3, 5, 10}; /** Source providing the data. */ private final FdSource source; /** Fundamental diagram line. */ private final FdLine fdLine; /** Quantity on domain axis. */ private Quantity domainQuantity; /** Quantity on range axis. */ private Quantity rangeQuantity; /** The other, 3rd quantity. */ private Quantity otherQuantity; /** Labels of series. */ private final List seriesLabels = new ArrayList<>(); /** Updater for update times. */ private final GraphUpdater