C# Класс NPlot.TradingDateTimeAxis

Provides a DateTime axis that removes non-trading days.
Наследование: DateTimeAxis
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
Clone ( ) : object

Deep copy of DateTimeAxis.

OnTradingDays ( double coord ) : bool

Check whether the given coordinate falls on trading days.

PhysicalToWorld ( PointF p, PointF physicalMin, PointF physicalMax, bool clip ) : double

Transforms a physical coordinate to an axis world coordinate given the physical extremites of the axis.

SparseWorldAdd ( double coord, double delta ) : double

Adds a delta amount to the given world coordinate in such a way that all "sparse gaps" are skipped. In other words, the returned value is in delta distance from the given in the "virtual" world.

TradingDateTimeAxis ( ) : System

Constructor

TradingDateTimeAxis ( Axis a ) : System

Copy Constructor

WithinTradingHours ( double coord ) : bool

Check whether the given coordinate falls within defined trading hours.

WorldToPhysical ( double coord, PointF physicalMin, PointF physicalMax, bool clip ) : PointF

World to physical coordinate transform.

Not sure how much time is spent in this often called function. If it's lots, then worth optimizing (there is scope to do so).

Защищенные методы

Метод Описание
DoClone ( TradingDateTimeAxis b, TradingDateTimeAxis a ) : void

Helper method for Clone.

LargeTickLabel ( System.DateTime tickDate ) : string

Get an appropriate label name, given the DateTime of a label

ReverseSparseWorldRemap ( double coord ) : double

Remaps a "virtual" world coordinates back to true world coordinates.

SparseWorldRemap ( double coord ) : double

Remap a world coordinate into a "virtual" world, where non-trading dates and times are collapsed.

This code works under asumption that there are exactly 24*60*60 seconds in a day This is strictly speaking not correct but apparently .NET 2.0 does not count leap seconds. Luckilly, Ticks == 0 =~= 0001-01-01T00:00 =~= Monday First tried a version fully on floating point arithmetic, but failed hopelessly due to rounding errors.

Приватные методы

Метод Описание
Init ( ) : void

Helper function for constructors.

WorldTickPositions_FirstPass ( Point physicalMin, Point physicalMax, ArrayList &largeTickPositions, ArrayList &smallTickPositions ) : void

Determines the positions of all Large and Small ticks.

The method WorldTickPositions_FirstPass() from the base works just fine, except that it does not account for non-trading gaps in time, therefore, when less than two days are visible an own algorithm is used (to show intraday time). Otherwise the base class implementation is used but the output is corrected to remove ticks on non-trading days (Sat, Sun).

Описание методов

Clone() публичный Метод

Deep copy of DateTimeAxis.
public Clone ( ) : object
Результат object

DoClone() защищенный статический Метод

Helper method for Clone.
protected static DoClone ( TradingDateTimeAxis b, TradingDateTimeAxis a ) : void
b TradingDateTimeAxis The cloned source object.
a TradingDateTimeAxis The cloned target object.
Результат void

LargeTickLabel() защищенный Метод

Get an appropriate label name, given the DateTime of a label
protected LargeTickLabel ( System.DateTime tickDate ) : string
tickDate System.DateTime the DateTime to get the label name for
Результат string

OnTradingDays() публичный Метод

Check whether the given coordinate falls on trading days.
public OnTradingDays ( double coord ) : bool
coord double world coordinate in ticks to check.
Результат bool

PhysicalToWorld() публичный Метод

Transforms a physical coordinate to an axis world coordinate given the physical extremites of the axis.
public PhysicalToWorld ( PointF p, PointF physicalMin, PointF physicalMax, bool clip ) : double
p PointF the point to convert
physicalMin PointF the physical minimum extremity of the axis
physicalMax PointF the physical maximum extremity of the axis
clip bool whether or not to clip the world value to lie in the range of the axis if it is outside.
Результат double

ReverseSparseWorldRemap() защищенный Метод

Remaps a "virtual" world coordinates back to true world coordinates.
protected ReverseSparseWorldRemap ( double coord ) : double
coord double virtual world coordinate to transform.
Результат double

SparseWorldAdd() публичный Метод

Adds a delta amount to the given world coordinate in such a way that all "sparse gaps" are skipped. In other words, the returned value is in delta distance from the given in the "virtual" world.
public SparseWorldAdd ( double coord, double delta ) : double
coord double world coordinate to shift.
delta double shif amount in "virtual" units.
Результат double

SparseWorldRemap() защищенный Метод

Remap a world coordinate into a "virtual" world, where non-trading dates and times are collapsed.
This code works under asumption that there are exactly 24*60*60 seconds in a day This is strictly speaking not correct but apparently .NET 2.0 does not count leap seconds. Luckilly, Ticks == 0 =~= 0001-01-01T00:00 =~= Monday First tried a version fully on floating point arithmetic, but failed hopelessly due to rounding errors.
protected SparseWorldRemap ( double coord ) : double
coord double world coordinate to transform.
Результат double

TradingDateTimeAxis() публичный Метод

Constructor
public TradingDateTimeAxis ( ) : System
Результат System

TradingDateTimeAxis() публичный Метод

Copy Constructor
public TradingDateTimeAxis ( Axis a ) : System
a Axis construct a TradingDateTimeAxis based on this provided axis.
Результат System

WithinTradingHours() публичный Метод

Check whether the given coordinate falls within defined trading hours.
public WithinTradingHours ( double coord ) : bool
coord double world coordinate in ticks to check.
Результат bool

WorldToPhysical() публичный Метод

World to physical coordinate transform.
Not sure how much time is spent in this often called function. If it's lots, then worth optimizing (there is scope to do so).
public WorldToPhysical ( double coord, PointF physicalMin, PointF physicalMax, bool clip ) : PointF
coord double The coordinate value to transform.
physicalMin PointF The physical position corresponding to the world minimum of the axis.
physicalMax PointF The physical position corresponding to the world maximum of the axis.
clip bool if false, then physical value may extend outside worldMin / worldMax. If true, the physical value returned will be clipped to physicalMin or physicalMax if it lies outside this range.
Результат PointF