VectSharp 2.6.1
A light library for C# vector graphics
All Classes Namespaces Functions Variables Enumerations Properties Events Pages
VectSharp.Plots.MovingAverageTrendLine Class Reference

A plot element that draws a moving average trendline. More...

Inheritance diagram for VectSharp.Plots.MovingAverageTrendLine:

Public Member Functions

 MovingAverageTrendLine (IReadOnlyList< IReadOnlyList< double > > data, int period, ICoordinateSystem< IReadOnlyList< double > > coordinateSystem)
 Create a new MovingAverageTrendLine instance from the specified data. More...
 
 MovingAverageTrendLine (IReadOnlyList<(double, double)> data, int period, IContinuousCoordinateSystem coordinateSystem)
 Create a new MovingAverageTrendLine instance from the specified data. More...
 
void Plot (Graphics target)
 Draw the plot element on the specified target &#160;Graphics.
Parameters
targetThe Graphics on which to draw.
More...
 
void Plot (Graphics target)
 Draw the plot element on the specified target &#160;Graphics. More...
 

Properties

IReadOnlyList< IReadOnlyList< double > > Data [get, set]
 The data used to compute the moving average. These must be sorted in a sensible way. More...
 
Func< int, double[], double > Weight = (int i, double[] d) => 1 [get, set]
 The weight function. This should accept two parameters: an int representing the difference in index between the point being weighted and the "focus point", and a double[] representing the difference in coordinates between the two points. It should return a double representing the weight (it does not need to be normalised). More...
 
int Period [get, set]
 The number of points that are averaged to obtain the value for each point. This must be ≥ 0. More...
 
PlotElementPresentationAttributes PresentationAttributes = new PlotElementPresentationAttributes() { LineDash = new LineDash(5, 5, 0), Stroke = Colour.FromRgb(180, 180, 180) } [get, set]
 Presentation attributes for the trendline. More...
 
string Tag [get, set]
 A tag to identify the trendline in the plot. More...
 
ICoordinateSystem< IReadOnlyList< double > > CoordinateSystem [get, set]
 The coordinate system used to transform the points from data space to plot space. More...
 
- Properties inherited from VectSharp.Plots.IPlotElement
ICoordinateSystem CoordinateSystem [get]
 The coordinate system used to transform the points from data space to plot space. More...
 

Detailed Description

A plot element that draws a moving average trendline.

Definition at line 1074 of file Trendlines.cs.

Constructor & Destructor Documentation

◆ MovingAverageTrendLine() [1/2]

VectSharp.Plots.MovingAverageTrendLine.MovingAverageTrendLine ( IReadOnlyList< IReadOnlyList< double > >  data,
int  period,
ICoordinateSystem< IReadOnlyList< double > >  coordinateSystem 
)

Create a new MovingAverageTrendLine instance from the specified data.

Parameters
dataThe data used to compute the moving average. These must be sorted in a sensible way.
periodThe number of points that are averaged to obtain the value for each point. This must be ≥ 0.
coordinateSystemThe coordinate system used to transform the points from data space to plot space.
Exceptions
ArgumentOutOfRangeExceptionThrown if the period is < 0.

Definition at line 1117 of file Trendlines.cs.

◆ MovingAverageTrendLine() [2/2]

VectSharp.Plots.MovingAverageTrendLine.MovingAverageTrendLine ( IReadOnlyList<(double, double)>  data,
int  period,
IContinuousCoordinateSystem  coordinateSystem 
)

Create a new MovingAverageTrendLine instance from the specified data.

Parameters
dataThe data used to compute the moving average. These must be sorted in a sensible way.
periodThe number of points that are averaged to obtain the value for each point. This must be ≥ 0.
coordinateSystemThe coordinate system used to transform the points from data space to plot space.
Exceptions
ArgumentOutOfRangeExceptionThrown if the period is < 0.

Definition at line 1136 of file Trendlines.cs.

Member Function Documentation

◆ Plot()

void VectSharp.Plots.MovingAverageTrendLine.Plot ( Graphics  target)

Draw the plot element on the specified target &#160;Graphics.

Parameters
targetThe Graphics on which to draw.

Implements VectSharp.Plots.IPlotElement.

Definition at line 1139 of file Trendlines.cs.

Property Documentation

◆ CoordinateSystem

ICoordinateSystem<IReadOnlyList<double> > VectSharp.Plots.MovingAverageTrendLine.CoordinateSystem
getset

The coordinate system used to transform the points from data space to plot space.

Implements VectSharp.Plots.IPlotElement.

Definition at line 1107 of file Trendlines.cs.

◆ Data

IReadOnlyList<IReadOnlyList<double> > VectSharp.Plots.MovingAverageTrendLine.Data
getset

The data used to compute the moving average. These must be sorted in a sensible way.

Definition at line 1079 of file Trendlines.cs.

◆ Period

int VectSharp.Plots.MovingAverageTrendLine.Period
getset

The number of points that are averaged to obtain the value for each point. This must be ≥ 0.

Definition at line 1092 of file Trendlines.cs.

◆ PresentationAttributes

PlotElementPresentationAttributes VectSharp.Plots.MovingAverageTrendLine.PresentationAttributes = new PlotElementPresentationAttributes() { LineDash = new LineDash(5, 5, 0), Stroke = Colour.FromRgb(180, 180, 180) }
getset

Presentation attributes for the trendline.

Definition at line 1097 of file Trendlines.cs.

◆ Tag

string VectSharp.Plots.MovingAverageTrendLine.Tag
getset

A tag to identify the trendline in the plot.

Definition at line 1102 of file Trendlines.cs.

◆ Weight

Func<int, double[], double> VectSharp.Plots.MovingAverageTrendLine.Weight = (int i, double[] d) => 1
getset

The weight function. This should accept two parameters: an int representing the difference in index between the point being weighted and the "focus point", and a double[] representing the difference in coordinates between the two points. It should return a double representing the weight (it does not need to be normalised).

Definition at line 1087 of file Trendlines.cs.


The documentation for this class was generated from the following file: