Show / Hide Table of Contents

Class Plotter

Class to log data, and save as CSV, or present with Excel or R.

Inheritance
object
Plotter
Plotter
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: TuringTrader.Simulator
Assembly: TuringTrader.Simulator.dll
Syntax
public class Plotter

Constructors

| Edit this page View Source

Plotter(IAlgorithm)

Create and initialize logger object.

Declaration
public Plotter(IAlgorithm parentAlgorithm = null)
Parameters
Type Name Description
IAlgorithm parentAlgorithm

Properties

| Edit this page View Source

AllData

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
Dictionary<string, List<Dictionary<string, object>>>
| Edit this page View Source

ParentAlgorithm

Parent algorithm of plotter object, may be null.

Declaration
public IAlgorithm ParentAlgorithm { get; }
Property Value
Type Description
IAlgorithm
| Edit this page View Source

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

| Edit this page View Source

Clear()

Clear all current data.

Declaration
public void Clear()
| Edit this page View Source

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

| Edit this page View Source

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

| Edit this page View Source

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

Func<object, string> toString

function to convert object to string, default null

Returns
Type Description
int
| Edit this page View Source

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

| Edit this page View Source

SetX(object)

Set value along x-asis.

Declaration
public void SetX(object xValue)
Parameters
Type Name Description
object xValue

x-axis value

Events

| Edit this page View Source

Renderer

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
  • Edit this page
  • View Source
In this article
Back to top Copyright © 2011-2023, Bertram Enterprises LLC dba TuringTrader.com