OpenAPI 1.0

com.aquafold.openapi.chart
Interface AQSeriesFunction


public interface AQSeriesFunction

SeriesFunction

Synopsis:

SeriesFunction is a function which accepts a set of parameters and generates a series of data

Description:

SeriesFunctions are specified in the ChartProperties to add a data series generated by a mathematical function.

Functions can be performed on values contained in other series. These series references are specified using a zero-based index.

By default, functions are performed on all values in the series.
However, functions can also be performed on a selected range of values, using zero-based indexes to specify the start & end rows.
Both start & end row parameters are optional.

The currently supported functions (and their parameters) are:

Add (Series A, Series B, Start Row, End Row)
For each row, adds the value in Series A to the value in Series B, and stores the result in the function series.

Average (Series, Start Row, End Row)
Computes the average of all values in the Series, and stores that value in each row of the function series.

LinearRegression (Series, Start Row, End Row)
Apply a linear regression to the Series, and store the values of the resulting line in the function series.

Log (Series, Log Base, Start Row, End Row)
For each row, find the logarithm for the value in the Series using the specified Log Base, and store the result in the function series.

Moving Average (Series, Range, Start Row, End Row)
For each row, perform a Moving Average on the Series values using the specified Range, and store the result in the function series.

Power (Series, Exponent, Start Row, End Row)
For each row, raise the value in the Series to power specified in the Exponent, and store the result in the function series.

Scalar (Series, Scalar Multiplier, Start Row, End Row)
For each row, multiply the value in the Series by the Scalar Multiplier, and store the result in the function series.

Subtract (Series A, Series B, Start Row, End Row)
For each row, subtract the value in Series B from the value in Series A, and store the result in the function series.

Zero ()
For each row, store a value of zero (0) in the function series.


Method Summary
 List<Number> evaluate(List<AQFunctionParameter> parameters, AQChartModel model)
          Evaluate the function using the specified parameters and data model.
 String getFunctionWithParameterDescriptions()
          Get a description of the function, including parameter names.
 String getFunctionWithParameterValues()
          Get a description of the function, including parameter values.
 List<String> getMetaData()
          Get metadata returned by the function.
 String getName()
          Get the name of the function.
 String[] getParameterDescriptions()
          Get an array of string parameter descriptions.
 String getParameterDescriptionsString()
          Get a string containing the parameter descriptions.
 List<AQFunctionParameter> getParameters()
          Get the list of function parameters.
 String getParameterValuesString()
          Get a string containing the parameter values.
 boolean isValid(List<AQFunctionParameter> parameters, AQChartModel model, int functionSeriesIndex)
          Returns TRUE if the specified function parameters are valid when used with the ChartModel.
 void setParameters(List<AQFunctionParameter> functionParameters)
          Set the list of function parameters.
 boolean setParameters(String parameterString)
          Set the function parameters using by parsing the specified string.
 

Method Detail

getName

String getName()
Get the name of the function.

Returns:
Function name

getParameterDescriptions

String[] getParameterDescriptions()
Get an array of string parameter descriptions.

Returns:
Array of String parameter descriptions

evaluate

List<Number> evaluate(List<AQFunctionParameter> parameters,
                      AQChartModel model)
Evaluate the function using the specified parameters and data model.

The result of the evaluation is the list of values generated by the function.

Parameters:
parameters - List of function parameters
model - Data model
Returns:
List of numbers generated by the function

isValid

boolean isValid(List<AQFunctionParameter> parameters,
                AQChartModel model,
                int functionSeriesIndex)
Returns TRUE if the specified function parameters are valid when used with the ChartModel.

Common causes for invalid parameters are:
Incorrect series indexes (Indexes are zero-based)
Using String values instead of numeric values

Parameters:
parameters - List of function parameters
model - Data model
functionSeriesIndex - index of function series
Returns:
True if the function parameters are valid

getMetaData

List<String> getMetaData()
Get metadata returned by the function.

Currently, the only function which generates metadata is LinearRegression.

Returns:
List of String containing metadata generated by the function

getFunctionWithParameterDescriptions

String getFunctionWithParameterDescriptions()
Get a description of the function, including parameter names.

For example:
Add(Series A, Series B, Row Start, Row End)

Returns:
String containing function name with parameter descriptions

getFunctionWithParameterValues

String getFunctionWithParameterValues()
Get a description of the function, including parameter values.

For example:
Add(1,2)

Returns:
String containing function name with parameter values

getParameterValuesString

String getParameterValuesString()
Get a string containing the parameter values.

For example:
If the function is "Add(1,2)", this method returns:
1,2

Returns:
String containing parameter values

getParameterDescriptionsString

String getParameterDescriptionsString()
Get a string containing the parameter descriptions.

For example:
If the function is "Add(Series A, Series B, Row Start, Row End)", this method returns:
Series A, Series B, Row Start, Row End

Returns:
String containing parameter descriptions

setParameters

boolean setParameters(String parameterString)
Set the function parameters using by parsing the specified string.

For example:
Calling this:
myAddFunction.setParameters("1,2")
will set the two parameters of myAddFunction to the integer values of 1 and 2, respectively.

Parameters:
parameterString - String containing parameter values
Returns:
True if the parameters were set successfully

getParameters

List<AQFunctionParameter> getParameters()
Get the list of function parameters.

Returns:
List of function parameters

setParameters

void setParameters(List<AQFunctionParameter> functionParameters)
Set the list of function parameters.

Parameters:
functionParameters - List of function parameters

OpenAPI 1.0


Copyright © 2010 AquaFold, Inc. All Rights Reserved. Use is subject to license terms.