Hide Comments
Hide Comments

TRSFMXHighLowAverageChartFunction Class

Comments (0)

Implements a chart function class that applies a function to an input SourceChart and adds values to a FMX.RS.BarCharts.TRSHighLowAverageChart or FMX.RS.BarCharts.TRSCandleStickChart. The functions are able to modify multiple values of the Target chart at once (e.g., High, Low, and Average).

The TRSHighLowAverageChartFunction class provides specific functions applicable to high/low/average charts and candlestick charts. The function is applied over a Period of the SourceChart.
 

ChartFunctionExample

Chart Function Example showing automatic generation of hourly High/Low/Average data from a Source Line chart to a High/Low/Average Target Chart.

Namespace: FMX.RS.BarCharts

expandingInheritance Hierarchy

TComponent
  FMX.RS.ChartFunction.TRSFMXCustomChartFunction
    FMX.RS.BarCharts.TRSFMXHighLowAverageChartFunction
 

expandingSyntax

Delphi

type
  TRSFMXHighLowAverageChartFunction = class(TRSFMXCustomChartFunction)
  end; 
 

expandingConstructors

 

Name

Description

public constructor

Create(TComponent)

Initializes a new instance of the TRSFMXCustomChartFunction class. (Inherited from FMX.RS.ChartFunction.TRSFMXCustomChartFunction.)

Top

expandingProperties

 

Name

Description

public property

CenterTimePeriod

Represents property CenterTimePeriod. (Inherited from FMX.RS.ChartFunction.TRSFMXCustomChartFunction.)

published property

Enabled

Represents property Enabled.

published property

FunctionType

Defines the function to apply to the SourceChart to generate the TargetChart values

To define a custom function, set FunctionType to hlaCustom and create an OnCustomFunction event handler

protected property

Modified

Represents property Modified. (Inherited from FMX.RS.ChartFunction.TRSFMXCustomChartFunction.)

published property

OnCustomFunction

Represents property OnCustomFunction.

published property

OnExecutedFunction

Represents property OnExecutedFunction.

published property

OnExecutingFunction

Represents property OnExecutingFunction.

published property

Period

Represents property Period.

published property

PeriodValue

Represents property PeriodValue.

published property

SourceChart

Represents property SourceChart.

public property

SourceDim

Defines the input source dimension to apply the function on (Inherited from FMX.RS.ChartFunction.TRSFMXCustomChartFunction.)

published property

TargetChart

Defines the output or target chart for the function. The function transforms the input SourceChart values and adds values to the TargetChart

alert_cautionImportant Note

The old TargetChart values are deleted every time the function executes

public property

TargetDim

Defines the output target dimension to apply the function on (Inherited from FMX.RS.ChartFunction.TRSFMXCustomChartFunction.)

Top

expandingMethods

 

Name

Description

public methodClass member

AddValue(TRSCustomChart,TRSChartValueType[])

Overloaded. Adds an array of values to the Target Chart. Values order is assumed to be TimeStamp, High, Low, Average, Close, Open.
 

public methodClass member

Average(TRSCustomChart,Integer,Integer,TDateTime,Integer)

Overloaded. Calculates the average of all values from IndexLow to IndexHigh in the SourceChart and returns the average (Inherited from FMX.RS.ChartFunction.TRSFMXCustomChartFunction.)

public methodClass member

Average(TRSCustomChart,TRSCustomChart,Integer,Integer,TDateTime,Integer,Integer)

Overloaded. Calculates the average of all values from IndexLow to IndexHigh in the SourceChart and adds the average to the TargetChart. If the TargetChart is of a type that has more than 2 dimensions, such as a TRSLineChart with X and Y values, the new TargetChart value includes the TimeStamp. (Inherited from FMX.RS.ChartFunction.TRSFMXCustomChartFunction.)

protected method

Changed

Represents method Changed. (Inherited from FMX.RS.ChartFunction.TRSFMXCustomChartFunction.)

public method

ChartAdded(TRSCustomChart)

IChartPanelListener interface method that occurs when a chart is added to a panel. It is ignored by the function class. (Inherited from FMX.RS.ChartFunction.TRSFMXCustomChartFunction.)

public method

ChartChanged(TRSCustomChart)

IChartPanelListener interface method that occurs when the SourceChart changes (e.g., Caption, Align, etc) . It is ignored by the function class. (Inherited from FMX.RS.ChartFunction.TRSFMXCustomChartFunction.)

public method

ChartDeleted(TRSCustomChart)

IChartPanelListener interface method that occurs when a chart is removed from a panel. It is ignored by the function class. (Inherited from FMX.RS.ChartFunction.TRSFMXCustomChartFunction.)

public methodClass member

Copy(TRSCustomChart,TRSCustomChart,Integer,Integer,TDateTime,Integer,Integer)

Overloaded. Represents method Copy(TRSCustomChart,TRSCustomChart,Integer,Integer,TDateTime,Integer,Integer). (Inherited from FMX.RS.ChartFunction.TRSFMXCustomChartFunction.)

protected method

DoFunction

Represents method DoFunction. (Inherited from FMX.RS.ChartFunction.TRSFMXCustomChartFunction.)

public methodClass member

GetPeriodIndex(TRSCustomChart,Integer,TDateTime)

Returns the Source Chart Index for the end of the period defined by the StopTime from the LowIndex (Inherited from FMX.RS.ChartFunction.TRSFMXCustomChartFunction.)

public methodClass member

GreatestCommonDivisor(TRSCustomChart,Integer,Integer,TDateTime,Integer)

Overloaded. Calculates the greatest common divisor (gcd) of the SourceChart Values and returns the value. The SourceChart Values are rounded into integers and the GCD calculated from this array. The GCD of two or more integers, when at least one of them is not zero, is the largest positive integer that divides the numbers without a remainder. For example, the GCD of 8 and 12 is 4. (Inherited from FMX.RS.ChartFunction.TRSFMXCustomChartFunction.)

public methodClass member

GreatestCommonDivisor(TRSCustomChart,TRSCustomChart,Integer,Integer,TDateTime,Integer,Integer)

Overloaded.  Calculates the greatest common divisor (gcd) of the SourceChart Values and adds the GCD to the TargetChart. The SourceChart Values are rounded into integers and the GCD calculated from this array. The GCD of two or more integers, when at least one of them is not zero, is the largest positive integer that divides the numbers without a remainder. For example, the GCD of 8 and 12 is 4.

If the TargetChart is of a type that has more than 2 dimensions, such as a TRSLineChart with X and Y values, the new TargetChart value includes the TimeStamp.

public methodClass member

HighLow(TRSCustomChart,TRSCustomChart,Integer,Integer,TDateTime,Integer,Integer)

Calculates the High and Low (Maximum and Minimum) of all values from IndexLow to IndexHigh in the SourceChart and adds the high and low to the TargetChart. The new TargetChart value includes the TimeStamp.

public methodClass member

HighLowAverage(TRSCustomChart,TRSCustomChart,Integer,Integer,TDateTime,Integer,Integer)

Calculates the High and Low (Maximum and Minimum) and the Average of all values from IndexLow to IndexHigh in the SourceChart and adds the high. low, and Average to the TargetChart. The new TargetChart value includes the TimeStamp.

public methodClass member

HighLowAverageOpenClose(TRSChartValueTypeArray)

Overloaded. Calculates the High and Low (Maximum and Minimum), Average, Open, and Close of all values from the input Data array and returns the metadata in an array. The results order is High, Low, Average, Close, Open.

public methodClass member

HighLowAverageOpenClose(TRSCustomChart,TRSCustomChart,Integer,Integer,TDateTime,Integer,Integer)

Overloaded. Calculates the High and Low (Maximum and Minimum), Average, Open, and Close of all values from IndexLow to IndexHigh in the SourceChart and adds them to the TargetChart. The new TargetChart value includes the TimeStamp.

noteNote

If the TargetChart is not a TRSCandleStickChart, the Open and Close values are ignored.

public methodClass member

HighLowMedian(TRSCustomChart,TRSCustomChart,Integer,Integer,TDateTime,Integer,Integer)

Calculates the High and Low (Maximum and Minimum) and Median of all values from IndexLow to IndexHigh in the SourceChart and adds the values to the TargetChart. The new TargetChart value includes the TimeStamp.

public method

IsModified

Returns true if the SourceChart has been modified since the last time the chart has applied the function (Inherited from FMX.RS.ChartFunction.TRSFMXCustomChartFunction.)

public methodClass member

Maximum(TRSCustomChart,Integer,Integer,TDateTime,Integer)

Overloaded. Calculates the maximum of all values from IndexLow to IndexHigh in the SourceChart and returns the maximum (Inherited from FMX.RS.ChartFunction.TRSFMXCustomChartFunction.)

public methodClass member

Maximum(TRSCustomChart,TRSCustomChart,Integer,Integer,TDateTime,Integer,Integer)

Overloaded. Calculates the maximum of all values from IndexLow to IndexHigh in the SourceChart and adds the maximum to the TargetChart. If the TargetChart is of a type that has more than 2 dimensions, such as a TRSLineChart with X and Y values, the new TargetChart value includes the TimeStamp. (Inherited from FMX.RS.ChartFunction.TRSFMXCustomChartFunction.)

public methodClass member

MeanStdDev(TRSCustomChart,TRSCustomChart,Integer,Integer,TDateTime,Integer,Integer)

Calculates the Mean and Standard Deviation for all the values from IndexLow to IndexHigh in the SourceChart and adds the high and low to the TargetChart. The new TargetChart value includes the TimeStamp.

public methodClass member

Median(TRSCustomChart,Integer,Integer,TDateTime,Integer)

Overloaded. Calculates the median of all values from IndexLow to IndexHigh in the SourceChart and returns the median. The function also returns the timestamp of the median value if the SourceChart contains timestamps (SourceChart.Values.IsDateTime=True) (Inherited from FMX.RS.ChartFunction.TRSFMXCustomChartFunction.)

public methodClass member

Median(TRSCustomChart,TRSCustomChart,Integer,Integer,TDateTime,Integer,Integer)

Overloaded. Calculates the median of all values from IndexLow to IndexHigh in the SourceChart and adds the median to the TargetChart. If the TargetChart is of a type that has more than 2 dimensions, such as a TRSLineChart with X and Y values, the new TargetChart value includes the TimeStamp. (Inherited from FMX.RS.ChartFunction.TRSFMXCustomChartFunction.)

public methodClass member

Minimum(TRSCustomChart,Integer,Integer,TDateTime,Integer)

Overloaded. Calculates the minimum of all values from IndexLow to IndexHigh in the SourceChart and returns the minimum (Inherited from FMX.RS.ChartFunction.TRSFMXCustomChartFunction.)

public methodClass member

Minimum(TRSCustomChart,TRSCustomChart,Integer,Integer,TDateTime,Integer,Integer)

Overloaded. Calculates the minimum of all values from IndexLow to IndexHigh in the SourceChart and adds the minimum to the TargetChart. If the TargetChart is of a type that has more than 2 dimensions, such as a TRSLineChart with X and Y values, the new TargetChart value includes the TimeStamp. (Inherited from FMX.RS.ChartFunction.TRSFMXCustomChartFunction.)

public methodClass member

Norm(TRSCustomChart,Integer,Integer,TDateTime,Integer)

Overloaded. Calculates the Euclidean 'L-2' norm for the values in the SourceChart over the time period. (Inherited from FMX.RS.ChartFunction.TRSFMXCustomChartFunction.)

public methodClass member

Norm(TRSCustomChart,TRSCustomChart,Integer,Integer,TDateTime,Integer,Integer)

Overloaded. Calculates the Euclidean 'L-2' norm for the values in the SourceChart over the time period and adds the value to the TargetChart. The 'L-2' norm is the square root of the sum of squares. If the TargetChart is of a type that has more than 2 dimensions, such as a TRSLineChart with X and Y values, the new TargetChart value includes the TimeStamp. (Inherited from FMX.RS.ChartFunction.TRSFMXCustomChartFunction.)

protected method

Notification(TComponent,TOperation)

Represents method Notification(TComponent,TOperation). (Inherited from FMX.RS.ChartFunction.TRSFMXCustomChartFunction.)

public method

PanelChange

IChartPanelListener interface method that occurs when the panel changes. It is ignored by the function class. (Inherited from FMX.RS.ChartFunction.TRSFMXCustomChartFunction.)

public method

PerformFunction

Executes the function on the SourceChart and adds values to the TargetChart

noteNote

Note that the old TargetChart values are deleted

public methodClass member

PopnStdDev(TRSCustomChart,Integer,Integer,TDateTime,Integer)

Overloaded. Calculates the population standard deviation (the square root of the population variance) of all values in the SourceChart over the time period. (Inherited from FMX.RS.ChartFunction.TRSFMXCustomChartFunction.)

public methodClass member

PopnStdDev(TRSCustomChart,TRSCustomChart,Integer,Integer,TDateTime,Integer,Integer)

Overloaded. Calculates the population standard deviation (the square root of the population variance) of all values in the SourceChart over the time period and adds the value to the TargetChart. If the TargetChart is of a type that has more than 2 dimensions, such as a TRSLineChart with X and Y values, the new TargetChart value includes the TimeStamp.
 (Inherited from FMX.RS.ChartFunction.TRSFMXCustomChartFunction.)

public methodClass member

PopnVariance(TRSCustomChart,Integer,Integer,TDateTime,Integer)

Overloaded. Calculates the population variance of all values in the SourceChart over the time period, using the n method (biased): TotalVariance / n. (Inherited from FMX.RS.ChartFunction.TRSFMXCustomChartFunction.)

public methodClass member

PopnVariance(TRSCustomChart,TRSCustomChart,Integer,Integer,TDateTime,Integer,Integer)

Overloaded. Calculates the population variance of all values in the SourceChart over the time period and adds the value to the TargetChart, using the n method (biased): TotalVariance / n. If the TargetChart is of a type that has more than 2 dimensions, such as a TRSLineChart with X and Y values, the new TargetChart value includes the TimeStamp.
 (Inherited from FMX.RS.ChartFunction.TRSFMXCustomChartFunction.)

public method

SelectionChanged(TObject)

IChartPanelListener interface method that occurs when the SourceChart's value is selected or deselected. It is ignored by the function class. (Inherited from FMX.RS.ChartFunction.TRSFMXCustomChartFunction.)

protected method

SetFunction

Represents method SetFunction. (Overrides FMX.RS.ChartFunction.TRSFMXCustomChartFunction.SetFunction.)

public methodClass member

StdDev(TRSCustomChart,Integer,Integer,TDateTime,Integer)

Overloaded. Calculates the sample standard deviation (the square root of the sample variance) of all SourceChart's values over the time period. (Inherited from FMX.RS.ChartFunction.TRSFMXCustomChartFunction.)

public methodClass member

StdDev(TRSCustomChart,TRSCustomChart,Integer,Integer,TDateTime,Integer,Integer)

Overloaded. Calculates the sample standard deviation (the square root of the sample variance) of all SourceChart's values over the time period and adds the value to the TargetChart. If the TargetChart is of a type that has more than 2 dimensions, such as a TRSLineChart with X and Y values, the new TargetChart value includes the TimeStamp. (Inherited from FMX.RS.ChartFunction.TRSFMXCustomChartFunction.)

public methodClass member

Sum(TRSCustomChart,Integer,Integer,TDateTime,Integer)

Overloaded. Calculates the sum of all values from IndexLow to IndexHigh in the SourceChart and returns the sum (Inherited from FMX.RS.ChartFunction.TRSFMXCustomChartFunction.)

public methodClass member

Sum(TRSCustomChart,TRSCustomChart,Integer,Integer,TDateTime,Integer,Integer)

Overloaded. Calculates the sum of all values from IndexLow to IndexHigh in the SourceChart and adds the sum to the TargetChart. If the TargetChart is of a type that has more than 2 dimensions, such as a TRSLineChart with X and Y values, the new TargetChart value includes the TimeStamp. (Inherited from FMX.RS.ChartFunction.TRSFMXCustomChartFunction.)

public methodClass member

SumOfSquares(TRSCustomChart,Integer,Integer,TDateTime,Integer)

Overloaded. Calculates the sum of the squares of the SourceChart values over the time period: Data[0]^2 + Data[1]^2 + Data[2]^2.... (Inherited from FMX.RS.ChartFunction.TRSFMXCustomChartFunction.)

public methodClass member

SumOfSquares(TRSCustomChart,TRSCustomChart,Integer,Integer,TDateTime,Integer,Integer)

Overloaded. Calculates the sum of the squares of the SourceChart values over the time period: Data[0]^2 + Data[1]^2 + Data[2]^2...and adds the value to the TargetChart. If the TargetChart
is of a type that has more than 2 dimensions, such as a TRSLineChart with X and Y values, the new TargetChart value includes the TimeStamp.
 (Inherited from FMX.RS.ChartFunction.TRSFMXCustomChartFunction.)

public methodClass member

ToArray(TRSCustomChart,Integer,Integer,Integer)

Creates a TRSChartValueTypeArray of all the Values in the Chart from IndexLow to IndexHigh for the specified dimension (Inherited from FMX.RS.ChartFunction.TRSFMXCustomChartFunction.)

public methodClass member

TotalVariance(TRSCustomChart,Integer,Integer,TDateTime,Integer)

Overloaded. Calculates the sum of the squares of the difference between each SourceChart value and the mean of the SourceChart values over the time period. (Inherited from FMX.RS.ChartFunction.TRSFMXCustomChartFunction.)

public methodClass member

TotalVariance(TRSCustomChart,TRSCustomChart,Integer,Integer,TDateTime,Integer,Integer)

Overloaded. Calculates the sum of the squares of the difference between each SourceChart value and the mean of the SourceChart values over the time period and adds the value to the TargetChart. If the TargetChart is of a type that has more than 2 dimensions, such as a TRSLineChart with X and Y values, the new TargetChart value includes the TimeStamp.
 (Inherited from FMX.RS.ChartFunction.TRSFMXCustomChartFunction.)

public method

ValueChanged(TRSCustomChart,TRSChartValue)

IChartPanelListener interface method that occurs when the SourceChart's value is changed. If the function class is Enabled, new values are generated for the TargetChart. (Inherited from FMX.RS.ChartFunction.TRSFMXCustomChartFunction.)

public methodClass member

Variance(TRSCustomChart,Integer,Integer,TDateTime,Integer)

Overloaded. Calculates the sample variance of all values in the SourceChart over the time period, using the n-1 method (unbiased). (Inherited from FMX.RS.ChartFunction.TRSFMXCustomChartFunction.)

public methodClass member

Variance(TRSCustomChart,TRSCustomChart,Integer,Integer,TDateTime,Integer,Integer)

Overloaded. Calculates the sample variance of all values in the SourceChart over the time period and adds the value to the TargetChart, using the n-1 method (unbiased). If the TargetChart is of a type that has more than 2 dimensions, such as a TRSLineChart with X and Y values, the new TargetChart value includes the TimeStamp.
 (Inherited from FMX.RS.ChartFunction.TRSFMXCustomChartFunction.)

public method

VisibleChanged(TObject)

IChartPanelListener interface method that occurs when the SourceChart's or value's visibility is changed. It is ignored by the function class. (Inherited from FMX.RS.ChartFunction.TRSFMXCustomChartFunction.)

Top

expandingEvents

 

Name

Description

protected event

ChartFunction

Represents property ChartFunction. (Inherited from FMX.RS.ChartFunction.TRSFMXCustomChartFunction.)

Top

expandingRemarks

The TRSHighLowAverageChartFunction class acts as a IChartPanelListener for the SourceChart. Every time the SourceChart fires a ValueChanged event, the class executes its function (if the Enabled property is true). For efficiency, you can turn off the Enabled property temporarily or make sure that you wrap changes to the SourceChart with BeginUpdate/EndUpdate.

expandingExamples

To set up a function at design-time:

Drop a chart onto your form and set it up as your SourceChart. Write code to populate the SourceChart.

Note that it is recommended you wrap adding values to the chart with Values.BeginUpdate and Values.EndUpdate)

Drop a TRSHighLowAverageChart or TRSCandleStickChart onto your form. This will be your TargetChart
Drop a TRSHighLowAverageChartFunction component on your form
Set RSHighLowAverageChartFunction1.SourceChart to your first chart above
Set RSHighLowAverageChartFunction1.TargetChart to your second chart above
Set RSHighLowAverageChartFunction1 Period and optionally PeriodValue
Set RSHighLowAverageChartFunction1.FunctionType
(Optional) If you wish to create a custom function, set RSHighLowAverageChartFunction1.FunctionType to hlaCustom and write an OnCustomFunction event handler

To set up a function at run-time:

Delphi

RSHighLowAverageChartFunction1 := TRSHighLowAverageChartFunction.Create(Self);
 RSHighLowAverageChartFunction1.SourceChart := RSLineChart1;
 RSHighLowAverageChartFunction1.PeriodValue := 0.25;
 RSHighLowAverageChartFunction1.Period := cfpPercentageCount;
 RSHighLowAverageChartFunction1.FunctionType := cftMaximum; 

expandingSee Also

Comments (0)

RiverSoftAVG Charting Component Suite (RCCS) © 2005-2015, Thomas G. Grubb