ChartDirector 5.1 (PHP Edition)

ArrayMath


The ArrayMath class is a utility class used to perform array computations.

MethodInheritedDescription
ArrayMath(Self)Creates an ArrayMath object and initialize it with the given array.
add(Self)Adds an array to the ArrayMath object.
add2(Self)Adds a number to every element of the ArrayMath object.
sub(Self)Subtracts an array from the ArrayMath object.
sub2(Self)Subtracts a number from every element of the ArrayMath object.
mul(Self)Multiplies an array to the ArrayMath object.
mul2(Self)Multiplies a number to every element of the ArrayMath object.
div(Self)Divides the ArrayMath object by the given array.
div2(Self)Divides every element of the ArrayMath object by the given number.
financeDiv(Self)Divides the ArrayMath object by the given array, with special handling of the case of zero divided by zero.
shift(Self)Shifts the array "rightwards".
delta(Self)Subtracts each element of the ArrayMath object by an earlier element in the same ArrayMath object.
rate(Self)Divides each element of the ArrayMath object by an earlier element in the same ArrayMath object.
abs(Self)Replaces each element of the ArrayMath object by its absolute value.
acc(Self)Replaces each element of the ArrayMath object by the accumulated total of its previous element (including itself).
selectGTZ(Self)Selects the elements of the ArrayMath object by checking if the elements of the given decisionArray is greater than zero.
selectGEZ(Self)Selects the elements of the ArrayMath object by checking if the elements of the given decisionArray is greater than or equal to zero.
selectLTZ(Self)Selects the elements of the ArrayMath object by checking if the elements of the given decisionArray is less than zero.
selectLEZ(Self)Selects the elements of the ArrayMath object by checking if the elements of the given decisionArray is less than or equal to zero.
selectEQZ(Self)Selects the elements of the ArrayMath object by checking if the elements of the given decisionArray is equal to zero.
selectNEZ(Self)Selects the elements of the ArrayMath object by checking if the elements of the given decisionArray is not equal to zero.
selectStartOfHour(Self)Selects the elements of the ArrayMath object that represents a different hour from the previous element.
selectStartOfDay(Self)Selects the elements of the ArrayMath object that represents a different day from the previous element.
selectStartOfWeek(Self)Selects the elements of the ArrayMath object that represents a different week from the previous element.
selectStartOfMonth(Self)Selects the elements of the ArrayMath object that represents a different month from the previous element.
selectStartOfYear(Self)Selects the elements of the ArrayMath object that represents a different year from the previous element.
selectRegularSpacing(Self)Selects an evenly spaced subset of elements of the ArrayMath object.
trim(Self)Trims the ArrayMath object by keeping only some elements in the middle.
insert(Self)Inserts the elements of an array to the ArrayMath object.
insert2(Self)Inserts some constant elements to the ArrayMath object.
replace(Self)Finds elements that are equal to a given value and replace it with another value.
movAvg(Self)Replaces each element of the ArrayMath object by its moving average.
expAvg(Self)Replaces each element of the ArrayMath object by its exponential average.
movMed(Self)Replaces each element of the ArrayMath object by its moving median.
movPercentile(Self)Replaces each element of the ArrayMath object by its moving percentile.
movMax(Self)Replaces each element of the ArrayMath object by its moving maximum.
movMin(Self)Replaces each element of the ArrayMath object by its moving minimum.
movStdDev(Self)Replaces each element of the ArrayMath object by its moving standard deviation.
movCorr(Self)Replaces each element of the ArrayMath object by the moving correlation with another array or with itself.
lowess(Self)Fits a curve through the data points in the ArrayMath object using the LOWESS algorithm.
lowess2(Self)Fits a curve through the data points in the ArrayMath object using the LOWESS algorithm, where the spacing of the data points is supplied by the given array.
result(Self)Gets the content of the ArrayMath object as a normal array to be used in other ChartDirector API.
sum(Self)Gets the sum value of the elements of the ArrayMath object.
max(Self)Gets the maximum value of the elements of the ArrayMath object.
min(Self)Gets the minimum value of the elements of the ArrayMath object.
avg(Self)Gets the avg value of the elements of the ArrayMath object.
med(Self)Gets the med value of the elements of the ArrayMath object.
percentile(Self)Gets the required percentile value of the elements of the ArrayMath object.
stdDev(Self)Gets the stdDev value of the elements of the ArrayMath object.
maxIndex(Self)Gets the index of the maximum value element of the ArrayMath object.
minIndex(Self)Gets the index of the minimum value element of the ArrayMath object.
aggregate(Self)Aggregates a data array by merging groups of elements, similar to the GROUP BY clause in SQL statements.