Skip to main content

OpenTD .NET8 reference 2025 R2

OpenTD.Results.Plot.Plot2d Class Reference

Last update: 16.07.2025

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. More...

Inheritance diagram for OpenTD.Results.Plot.Plot2d:
OpenTD.Results.Dataset.IAutoNameOpenTD.Results.Dataset.IAutoCommentOpenTD.Results.Plot.SimplePlot

Public Member Functions

 Plot2d (string title)
 
void SetSeriesPaletteColor (int index, Color color)
 
void SetPlotStyle (Plot2dStyle ps)
 
Plot2dStyle GetPlotStyle ()
 
 Plot2d ()
 
void AutoSetMarkers ()
 
void AutoSetAxes ()
 Makes sure each series is assigned to an axis with the correct dimension. Throws away unused axes.
 
void AutoScaleAxes ()
 Scales each axis based on the series attached to it.
 
void AutoNameXAxes ()
 
void AutoNameYAxesBasedOnSubtype ()
 
void AddSeries (Series2d series)
 
void AddSeries (DataArray xData, DataArray yData)
 
void AddSeries (DataArray yData)
 
void AddSeries (DataArrayCollection dataCollection, bool useFirstArrayAsXData=false)
 
void AddSeries (DataSubtype subtype, IEnumerable< double > values, UnitsData units=null, ItemIdentifier item=null)
 
void AddSeries (IEnumerable< double > xData)
 
List< Series2d > GetSeriesOnAxis (Axis a)
 
virtual Bitmap GetAsImage ()
 
void SaveAsImage (string pathname)
 
string GetAsTable (string delimiter=",", bool consolidateXData=true)
 
void SaveAsTable (string pathname, string delimiter=",", bool consolidateXData=true)
 Saves the plot as a tabular data.
 
virtual void Show ()
 
override string ToString ()
 

Protected Member Functions

virtual void GetReadyToOutput ()
 
void AutoSetLegend ()
 
virtual string GetSelfSuggestedName ()
 
virtual string GetSelfSuggestedComment ()
 

Properties

Plot2dStyle Plot2dStyle [get, set]
 
string Title [get, set]
 
Series2dCollection Series [get, set]
 
List< Axis > XAxes [get, set]
 
List< Axis > YAxes [get, set]
 
Legend Legend [get, set]
 
double AutoScaleAxesMarginPercent [get, set]
 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.
 
bool AutoUseMarkersForNonContinuousSeries [get, set]
 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.
 
bool TryToNameYAxesBasedOnSeriesSubtype [get, set]
 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.
 
AutoNamer AutoNamer [get, set]
 
string Name [get, set]
 
string InternalSuggestedName [get, set]
 
AutoCommenter AutoCommenter [get, set]
 
string Comment [get, set]
 
string InternalSuggestedComment [get, set]
 

Detailed Description

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.

See also
OpenTD.Results.Plot.SimplePlot, OpenTD.Results.Dataset.IAutoName

Constructor & Destructor Documentation

◆ Plot2d() [1/2]

OpenTD.Results.Plot.Plot2d.Plot2d ( string title)
inline

◆ Plot2d() [2/2]

OpenTD.Results.Plot.Plot2d.Plot2d ( )
inline

Member Function Documentation

◆ AddSeries() [1/6]

void OpenTD.Results.Plot.Plot2d.AddSeries ( DataArray xData,
DataArray yData )
inline

◆ AddSeries() [2/6]

void OpenTD.Results.Plot.Plot2d.AddSeries ( DataArray yData)
inline

◆ AddSeries() [3/6]

void OpenTD.Results.Plot.Plot2d.AddSeries ( DataArrayCollection dataCollection,
bool useFirstArrayAsXData = false )
inline

◆ AddSeries() [4/6]

void OpenTD.Results.Plot.Plot2d.AddSeries ( DataSubtype subtype,
IEnumerable< double > values,
UnitsData units = null,
ItemIdentifier item = null )
inline

◆ AddSeries() [5/6]

void OpenTD.Results.Plot.Plot2d.AddSeries ( IEnumerable< double > xData)
inline

◆ AddSeries() [6/6]

void OpenTD.Results.Plot.Plot2d.AddSeries ( Series2d series)
inline

◆ AutoNameXAxes()

void OpenTD.Results.Plot.Plot2d.AutoNameXAxes ( )
inline

◆ AutoNameYAxesBasedOnSubtype()

void OpenTD.Results.Plot.Plot2d.AutoNameYAxesBasedOnSubtype ( )
inline

◆ AutoScaleAxes()

void OpenTD.Results.Plot.Plot2d.AutoScaleAxes ( )
inline

Scales each axis based on the series attached to it.

Exceptions
OpenTDExceptionAutoScaleNumIntervals must be positive.

◆ AutoSetAxes()

void OpenTD.Results.Plot.Plot2d.AutoSetAxes ( )
inline

Makes sure each series is assigned to an axis with the correct dimension. Throws away unused axes.

◆ AutoSetLegend()

void OpenTD.Results.Plot.Plot2d.AutoSetLegend ( )
inlineprotected

◆ AutoSetMarkers()

void OpenTD.Results.Plot.Plot2d.AutoSetMarkers ( )
inline

◆ GetAsImage()

virtual Bitmap OpenTD.Results.Plot.Plot2d.GetAsImage ( )
inlinevirtual

Reimplemented in OpenTD.Results.Plot.SimplePlot.

◆ GetAsTable()

string OpenTD.Results.Plot.Plot2d.GetAsTable ( string delimiter = ",",
bool consolidateXData = true )
inline

◆ GetPlotStyle()

Plot2dStyle OpenTD.Results.Plot.Plot2d.GetPlotStyle ( )
inline

◆ GetReadyToOutput()

virtual void OpenTD.Results.Plot.Plot2d.GetReadyToOutput ( )
inlineprotectedvirtual

◆ GetSelfSuggestedComment()

virtual string OpenTD.Results.Plot.Plot2d.GetSelfSuggestedComment ( )
inlineprotectedvirtual

◆ GetSelfSuggestedName()

virtual string OpenTD.Results.Plot.Plot2d.GetSelfSuggestedName ( )
inlineprotectedvirtual

◆ GetSeriesOnAxis()

List< Series2d > OpenTD.Results.Plot.Plot2d.GetSeriesOnAxis ( Axis a)
inline

◆ SaveAsImage()

void OpenTD.Results.Plot.Plot2d.SaveAsImage ( string pathname)
inline

◆ SaveAsTable()

void OpenTD.Results.Plot.Plot2d.SaveAsTable ( string pathname,
string delimiter = ",",
bool consolidateXData = true )
inline

Saves the plot as a tabular data.

Parameters
pathnameThe output pathname.
delimiterThe column delimiter.
consolidateXDataif 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()

void OpenTD.Results.Plot.Plot2d.SetPlotStyle ( Plot2dStyle ps)
inline

◆ SetSeriesPaletteColor()

void OpenTD.Results.Plot.Plot2d.SetSeriesPaletteColor ( int index,
Color color )
inline

◆ Show()

virtual void OpenTD.Results.Plot.Plot2d.Show ( )
inlinevirtual

Reimplemented in OpenTD.Results.Plot.SimplePlot.

◆ ToString()

override string OpenTD.Results.Plot.Plot2d.ToString ( )
inline

Property Documentation

◆ AutoCommenter

AutoCommenter OpenTD.Results.Plot.Plot2d.AutoCommenter
getsetprotected

◆ AutoNamer

AutoNamer OpenTD.Results.Plot.Plot2d.AutoNamer
getsetprotected

◆ AutoScaleAxesMarginPercent

double OpenTD.Results.Plot.Plot2d.AutoScaleAxesMarginPercent
getset

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.

◆ AutoUseMarkersForNonContinuousSeries

bool OpenTD.Results.Plot.Plot2d.AutoUseMarkersForNonContinuousSeries
getset

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.

◆ Comment

string OpenTD.Results.Plot.Plot2d.Comment
getset

◆ InternalSuggestedComment

string OpenTD.Results.Plot.Plot2d.InternalSuggestedComment
getset

◆ InternalSuggestedName

string OpenTD.Results.Plot.Plot2d.InternalSuggestedName
getset

◆ Legend

Legend OpenTD.Results.Plot.Plot2d.Legend
getset

◆ Name

string OpenTD.Results.Plot.Plot2d.Name
getset

◆ Plot2dStyle

Plot2dStyle OpenTD.Results.Plot.Plot2d.Plot2dStyle
getset

◆ Series

Series2dCollection OpenTD.Results.Plot.Plot2d.Series
getset

◆ Title

string OpenTD.Results.Plot.Plot2d.Title
getset

◆ TryToNameYAxesBasedOnSeriesSubtype

bool OpenTD.Results.Plot.Plot2d.TryToNameYAxesBasedOnSeriesSubtype
getset

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.

◆ XAxes

List<Axis> OpenTD.Results.Plot.Plot2d.XAxes
getset

◆ YAxes

List<Axis> OpenTD.Results.Plot.Plot2d.YAxes
getset

The documentation for this class was generated from the following file:
  • C:/Users/mgarrett/source/repos/BuildsTdSuite/builds/OpenTD/OpenTD.Results/Plot/Plot2d.cs

Connect with Ansys