﻿ TRSCustomChartFunction.GreatestCommonDivisor(TRSCustomChart,TRSCustomChart,Integer,Integer,TDateTime,Integer,Integer) Method

# TRSCustomChartFunction.GreatestCommonDivisor(TRSCustomChart,TRSCustomChart,Integer,Integer,TDateTime,Integer,Integer) Method

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.

Namespace: RSChartFunction

 Syntax
 Delphi public   class procedure GreatestCommonDivisor(const SourceChart, TargetChart: TRSCustomChart;   IndexLow, IndexHigh: Integer; TimeStamp: TDateTime;   SourceDim: Integer;   TargetDim: Integer); overload;

Parameters

SourceChart

Type: TRSCustomChart

Chart to calculate the GCD from

TargetChart

Type: TRSCustomChart

Chart to add the calculated GCD to

IndexLow

Type: Integer

Lower bounds index into the SourceChart

IndexHigh

Type: Integer

Upper bounds index into the SourceChart

TimeStamp

Type: TDateTime

TimeStamp to attach to the new value

SourceDim

Type: Integer

TargetDim

Type: Integer

 Remarks
 Note that this function is a class procedure so it may be called even if the TRSCustomChartFunction is not instantiated. The function can also be called by custom functions. For example, you could create a custom function that calls this function and then does something with the result (which is in the last value of the TargetChart)