Hide Comments
Hide Comments

Comments (0)

Applies a function to an input SourceChart and adds values to a TargetChart.

The TRSChartFunction class provides basic functions such as average, maximum, and minimum, and allows you to define a custom function. The function is applied over a Period of the SourceChart.

alert_cautionCaution

The TRSChartFunction can accept any type of chart for its SourceChart and TargetChart. However, some combinations may be unpredicatable

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.ChartFunction

expandingInheritance Hierarchy

TComponent
  FMX.RS.ChartFunction.TRSFMXCustomChartFunction
    FMX.RS.ChartFunction.TRSFMXChartFunction
 

expandingSyntax

Delphi

type
  TRSFMXChartFunction = 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

Represents property FunctionType.

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

Represents property TargetChart.

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,TDateTime,Integer)

Adds the specified TimeStamp and Value to the Chart. The TimeStamp is set to the TRSCustomChart.Values.TimeDimension in the Values property if present and Value to TRSCustomChart.Values.DefaultDimension (Inherited from FMX.RS.ChartFunction.TRSFMXCustomChartFunction.)

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 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

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. (Inherited from FMX.RS.ChartFunction.TRSFMXCustomChartFunction.)

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 TRSChartFunction 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 another chart onto your form. This will be your TargetChart
Drop a TRSChartFunction component on your form
Set RSChartFunction1.SourceChart to your first chart above
Set RSChartFunction1.TargetChart to your second chart above
Set TRSChartFunction Period and optionally PeriodValue
Set RSChartFunction1.FunctionType
(Optional) If you wish to create a custom function, set RSChartFunction1.FunctionType to cftCustom and write an OnCustomFunction event handler

To set up a function at run-time:

Delphi

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

expandingSee Also

Comments (0)

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