Class Plot
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
Inherited Members
Namespace: TimeSeriesAnalysis.Utility
Assembly: TimeSeriesAnalysis.dll
Syntax
public class Plot
Methods
| Edit this page View SourceFromList(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
Declaration
public static string FromList(List<double[]> dataList, List<string> plotNames, DateTime[] dataTimes, string comment = null, string caseName = "", bool doStartChrome = true)
Parameters
Type | Name | Description |
---|---|---|
List<double[]> | dataList | |
List<string> | plotNames | |
DateTime[] | dataTimes | common timestamps |
string | comment | |
string | caseName | |
bool | doStartChrome |
Returns
Type | Description |
---|---|
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
Declaration
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
Type | Name | Description |
---|---|---|
List<double[]> | dataList | List of doubles, one entry for each time-series to be plotted |
List<string> | plotNames | 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 |
double | dT_s | the time between data samples in seconds |
string | comment | a comment that is shown in the plot |
DateTime | t0 | the DateTime of the first data point |
string | caseName | give each plot a casename if creating multiple plots with the re-occurring variable names |
bool | doStartChrome | By setting doStartChrome to false, you can skip opening up chrome, the link to figure will instead be returned |
Returns
Type | Description |
---|---|
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)
Declaration
public static string FromList(List<(double[], DateTime[])> dataDateTupleList, List<string> plotNames, string comment = null, string caseName = "", bool doStartChrome = true)
Parameters
Type | Name | Description |
---|---|---|
List<(double[], DateTime[])> | dataDateTupleList | |
List<string> | plotNames | |
string | comment | |
string | caseName | |
bool | doStartChrome |
Returns
Type | Description |
---|---|
string |