Class Plot2d
Last update: 09.03.2026Namespace: OpenTD.Results.Plot
Assembly: OpenTD.Results.dll
An abstract class representing a 2d plot. Inherit from it to take advantage of its many helpful features, such as auto-naming, auto-creating and scaling axes, etc. SimplePlot is a concrete definition of a Plot2d that uses the .NET charting tools. There are methods to display the plot on the screen, save it as a bitmap, and to output it as a table of data.
public abstract class Plot2d
Inheritance
Derived
Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
Constructors
Plot2d(string)
public Plot2d(string title)
Parameters
title string
Plot2d()
public Plot2d()
Properties
AutoCommenter
protected AutoCommenter AutoCommenter { get; set; }
Property Value
AutoCommenter
AutoNamer
protected AutoNamer AutoNamer { get; set; }
Property Value
AutoNamer
AutoScaleAxesMarginPercent
For axes that are autoscaled, this is the amount that each axis will be grown beyond the range of the data, as a percentage of the total range. Exceptions: if the minimum value of the data is 0, autoscaling will not extend the minimum value of the axis below 0. If the axis is for Record Numbers, autoscaling won't extend the minimum value of the axis below the first record number.
public double AutoScaleAxesMarginPercent { get; set; }
Property Value
AutoUseMarkersForNonContinuousSeries
If true, series that are detected to be non-continuous (because one or more y-values is NaN, for example) will have markers turned on automatically, to help spot orphaned points or small curve segments. This also applies to series with just one point.
public bool AutoUseMarkersForNonContinuousSeries { get; set; }
Property Value
Comment
public string Comment { get; set; }
Property Value
InternalSuggestedComment
public string InternalSuggestedComment { get; set; }
Property Value
InternalSuggestedName
public string InternalSuggestedName { get; set; }
Property Value
Legend
public Legend Legend { get; set; }
Property Value
Name
public string Name { get; set; }
Property Value
Plot2dStyle
public Plot2dStyle Plot2dStyle { get; set; }
Property Value
Series
public Series2dCollection Series { get; set; }
Property Value
Title
public string Title { get; set; }
Property Value
TryToNameYAxesBasedOnSeriesSubtype
Normally, Y axes are named based on their dimension, e.g., "Temperature". If this member is true, the plot will attempt to name them based on the subtype of the series applied to them, e.g., "Node Temperature" or "Lump Temperature". Defaults to false.
public bool TryToNameYAxesBasedOnSeriesSubtype { get; set; }
Property Value
XAxes
public List<Axis> XAxes { get; set; }
Property Value
YAxes
public List<Axis> YAxes { get; set; }
Property Value
Methods
AddSeries(Series2d)
public void AddSeries(Series2d series)
Parameters
series Series2d
AddSeries(DataArray, DataArray)
public void AddSeries(DataArray xData, DataArray yData)
Parameters
xData DataArray
yData DataArray
AddSeries(DataArray)
public void AddSeries(DataArray yData)
Parameters
yData DataArray
AddSeries(DataArrayCollection, bool)
public void AddSeries(DataArrayCollection dataCollection, bool useFirstArrayAsXData = false)
Parameters
dataCollection DataArrayCollection
useFirstArrayAsXData bool
AddSeries(DataSubtype, IEnumerable<double>, UnitsData, ItemIdentifier)
public void AddSeries(DataSubtype subtype, IEnumerable<double> values, UnitsData units = null, ItemIdentifier item = null)
Parameters
subtype DataSubtype
values IEnumerable<double>
units UnitsData
item ItemIdentifier
AddSeries(IEnumerable<double>)
public void AddSeries(IEnumerable<double> xData)
Parameters
xData IEnumerable<double>
AutoNameXAxes()
public void AutoNameXAxes()
AutoNameYAxesBasedOnSubtype()
public void AutoNameYAxesBasedOnSubtype()
AutoScaleAxes()
Scales each axis based on the series attached to it.
public void AutoScaleAxes()
Exceptions
OpenTDException
AutoScaleNumIntervals must be positive.
AutoSetAxes()
Makes sure each series is assigned to an axis with the correct dimension. Throws away unused axes.
public void AutoSetAxes()
AutoSetLegend()
protected void AutoSetLegend()
AutoSetMarkers()
public void AutoSetMarkers()
GetAsImage()
public virtual Bitmap GetAsImage()
Returns
GetAsTable(string, bool)
public string GetAsTable(string delimiter = ",", bool consolidateXData = true)
Parameters
delimiter string
consolidateXData bool
Returns
GetPlotStyle()
public Plot2dStyle GetPlotStyle()
Returns
GetReadyToOutput()
protected virtual void GetReadyToOutput()
GetSelfSuggestedComment()
protected virtual string GetSelfSuggestedComment()
Returns
GetSelfSuggestedName()
protected virtual string GetSelfSuggestedName()
Returns
GetSeriesOnAxis(Axis)
public List<Series2d> GetSeriesOnAxis(Axis a)
Parameters
a Axis
Returns
SaveAsImage(string)
public void SaveAsImage(string pathname)
Parameters
pathname string
SaveAsTable(string, string, bool)
Saves the plot as a tabular data.
public void SaveAsTable(string pathname, string delimiter = ",", bool consolidateXData = true)
Parameters
pathname string
The output pathname.
delimiter string
The column delimiter.
consolidateXData bool
if set to true, Will attempt to combine series x-values into the fewest possible
columns. Will only combine x-values if they point to exactly the same source, i.e., it
tests equality by reference, not by value.
SetPlotStyle(Plot2dStyle)
public void SetPlotStyle(Plot2dStyle ps)
Parameters
ps Plot2dStyle
SetSeriesPaletteColor(int, Color)
public void SetSeriesPaletteColor(int index, Color color)
Parameters
index int
color Color
Show()
public virtual void Show()
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
A string that represents the current object.
See Also
SimplePlot, IAutoName