Table of Contents

Class Plot

Namespace
TimeSeriesAnalysis.Utility
Assembly
TimeSeriesAnalysis.dll

Static methods for plotting one or more time-series across one or more y-axes and one or more subplots by opening up Chrome calling a set of JavaScript plotting methods based on plotly.js

Time-series are written as CSV-files to a specific folder on disk plotDataPath, before starting a chrome-window that loads a specific "localhost" plotlyURL that reads said CSV-files and initates an in-browser plot using plotly.js.

For this method to work you need to be running a web server such as IIS that serves up a "localhost" plotlyURL as described in the documentation.

If you sometimes need to disable plots (for instance if plotting code is included in unit tests) see Plot4Test

public class Plot
Inheritance
Plot
Inherited Members

Methods

FromList(List<double[]>, List<string>, DateTime[], string, string, bool)

Plot all variables in a list of doubles, that all have the same timestamps given by dataTimes

public static string FromList(List<double[]> dataList, List<string> plotNames, DateTime[] dataTimes, string comment = null, string caseName = "", bool doStartChrome = true)

Parameters

dataList List<double[]>
plotNames List<string>
dataTimes DateTime[]

common timestamps

comment string
caseName string
doStartChrome bool

Returns

string

FromList(List<double[]>, List<string>, double, string, DateTime, string, bool)

Plot values in a list of vectors dataList, when all vectors start at t0 and have a stedy sampling rate

public static string FromList(List<double[]> dataList, List<string> plotNames, double dT_s, string comment = null, DateTime t0 = default, string caseName = "", bool doStartChrome = true)

Parameters

dataList List<double[]>

List of doubles, one entry for each time-series to be plotted

plotNames List<string>

List of string of unique names to describe each plot, prefixed by either "y1="(top left),"y2="(top right),"y3="(bottom left) or "y4="(bottom right) to denote what y-axis to plot the variable on

dT_s double

the time between data samples in seconds

comment string

a comment that is shown in the plot

t0 DateTime

the DateTime of the first data point

caseName string

give each plot a casename if creating multiple plots with the re-occurring variable names

doStartChrome bool

By setting doStartChrome to false, you can skip opening up chrome, the link to figure will instead be returned

Returns

string

The url of the resulting plot is returned

FromList(List<(double[], DateTime[])>, List<string>, string, string, bool)

Plot data from a list of value-date tuples (each time-series can have unique time-vector with unique sampling)

public static string FromList(List<(double[], DateTime[])> dataDateTupleList, List<string> plotNames, string comment = null, string caseName = "", bool doStartChrome = true)

Parameters

dataDateTupleList List<(double[], DateTime[])>
plotNames List<string>
comment string
caseName string
doStartChrome bool

Returns

string