Class Plotter
Class to log data, and save as CSV, or present with Excel or R.
Inherited Members
Namespace: TuringTrader.Simulator
Assembly: TuringTrader.Simulator.dll
Syntax
public class Plotter
Constructors
| Improve this Doc View SourcePlotter(IAlgorithm)
Create and initialize logger object.
Declaration
public Plotter(IAlgorithm parentAlgorithm = null)
Parameters
Type | Name | Description |
---|---|---|
IAlgorithm | parentAlgorithm |
Properties
| Improve this Doc View SourceAllData
plotter data, indexed by chart title. for each chart, we have a list of dictionaries, one entry per row, with key being the name of the field.
Declaration
public Dictionary<string, List<Dictionary<string, object>>> AllData { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.Dictionary<TKey, TValue><string, System.Collections.Generic.List<T><System.Collections.Generic.Dictionary<TKey, TValue><string, object>>> |
ParentAlgorithm
Parent algorithm of plotter object, may be null.
Declaration
public IAlgorithm ParentAlgorithm { get; }
Property Value
Type | Description |
---|---|
IAlgorithm |
Title
Plotter object's title. Typically, this does not need to be set, as most of the time the title will be identical with the name of the chart. However, for stacked charts, we want to set the title independently.
Declaration
public string Title { get; set; }
Property Value
Type | Description |
---|---|
string |
Methods
| Improve this Doc View SourceClear()
Clear all current data.
Declaration
public void Clear()
OpenWith(string)
Open plot with Excel or R, depending on the template file. The template file can be an absolute path, a relative path, or a simple file name. Relative pathes as well as simple file names will both start from the Templates folder inside TuringTrader's home location.
Declaration
public void OpenWith(string pathToTemplateFile)
Parameters
Type | Name | Description |
---|---|---|
string | pathToTemplateFile | path to template file |
Plot(string, object)
Log new value to current plot, at current x-axis value.
Declaration
public void Plot(string yLabel, object yValue)
Parameters
Type | Name | Description |
---|---|---|
string | yLabel | y-axis label |
object | yValue | y-axis value |
SaveAsCsv(string, string, Func<object, string>)
Save log as CSV file.
Declaration
public int SaveAsCsv(string filePath, string plotTitle = null, Func<object, string> toString = null)
Parameters
Type | Name | Description |
---|---|---|
string | filePath | path to destination file |
string | plotTitle | plot to save, null for current plot |
System.Func<T, TResult><object, string> | toString | function to convert object to string, default null |
Returns
Type | Description |
---|---|
int |
SelectChart(string, string)
Select current chart.
Declaration
public void SelectChart(string chartTitle, string xLabel)
Parameters
Type | Name | Description |
---|---|---|
string | chartTitle | title of chart |
string | xLabel | label on x-axis |
SetX(object)
Set value along x-asis.
Declaration
public void SetX(object xValue)
Parameters
Type | Name | Description |
---|---|---|
object | xValue | x-axis value |
Events
| Improve this Doc View SourceRenderer
Renderer event. Renderers register with this event, to be invoked whenever rendering is required.
Declaration
public static event Plotter.renderer Renderer
Event Type
Type | Description |
---|---|
Plotter.renderer |