Skip to main content

OpenTD reference 2026 R1

Class Plot2d

Last update: 09.03.2026

Namespace: 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

object ← Plot2d

Derived

SimplePlot

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

double

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

bool

Comment

public string Comment { get; set; }

Property Value

string

InternalSuggestedComment

public string InternalSuggestedComment { get; set; }

Property Value

string

InternalSuggestedName

public string InternalSuggestedName { get; set; }

Property Value

string

Legend

public Legend Legend { get; set; }

Property Value

Legend

Name

public string Name { get; set; }

Property Value

string

Plot2dStyle

public Plot2dStyle Plot2dStyle { get; set; }

Property Value

Plot2dStyle

Series

public Series2dCollection Series { get; set; }

Property Value

Series2dCollection

Title

public string Title { get; set; }

Property Value

string

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

bool

XAxes

public List<Axis> XAxes { get; set; }

Property Value

List<Axis>

YAxes

public List<Axis> YAxes { get; set; }

Property Value

List<Axis>

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

Bitmap

GetAsTable(string, bool)

public string GetAsTable(string delimiter = ",", bool consolidateXData = true)

Parameters

delimiter string

consolidateXData bool

Returns

string

GetPlotStyle()

public Plot2dStyle GetPlotStyle()

Returns

Plot2dStyle

GetReadyToOutput()

protected virtual void GetReadyToOutput()

GetSelfSuggestedComment()

protected virtual string GetSelfSuggestedComment()

Returns

string

GetSelfSuggestedName()

protected virtual string GetSelfSuggestedName()

Returns

string

GetSeriesOnAxis(Axis)

public List<Series2d> GetSeriesOnAxis(Axis a)

Parameters

a Axis

Returns

List<Series2d>

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

string

A string that represents the current object.

See Also

SimplePlot, IAutoName

Connect with Ansys