Rogue Wave Views 5.5.1 |
Rogue Wave Views |
Rogue Wave Views Documentation Home |
Class for data sets described by a script function. More...
#include <ilviews/charts/scriptft.h>
Public Member Functions | |
IlvScriptChartFunction (const IlvCoordInterval &xRange, IlUInt count, const char *scriptFunctionName, IlvGraphicHolder *holder, const IlSymbol *scriptLanguageName=0, const char *name=0, IlvPointInfoCollection *ptInfoCollection=0) | |
Constructor. | |
IlvScriptChartFunction (const char *name=0, IlvPointInfoCollection *ptInfoCollection=0) | |
Constructor. | |
virtual | ~IlvScriptChartFunction () |
Destructor. | |
IlBoolean | callScriptFunction (IlDouble x, IlDouble &y) const |
Computes the ordinate value of a data point from the abscissa value. | |
virtual IlvChartDataSet * | copy () const |
Virtual copy constructor. | |
IlvGraphicHolder * | getHolder () const |
Returns the holder in which the script function is defined. | |
virtual void | getPoint (IlUInt i, IlvDoublePoint &point) const |
Returns a data point. | |
IlvScriptContext * | getScriptContext () const |
Returns the script context in which the script function is defined. | |
const char * | getScriptFunctionName () const |
Returns the script function name. | |
const IlSymbol * | getScriptLanguageName () const |
Returns the name of the scripting language used to write the script function. | |
virtual IlBoolean | isFunctionDefined () const |
Indicates whether the script function describing the data is defined. | |
void | setHolder (IlvGraphicHolder *holder) |
Sets the holder in which the script function is defined. | |
void | setScriptFunctionName (const char *name) |
Sets the script function name. | |
void | setScriptLanguageName (const IlSymbol *name) |
Sets the name of the scripting language used to write the script function. | |
virtual void | write (IlvOutputFile &) const |
Writes the attributes of the current object in a file. |
Class for data sets described by a script function.
Library: ilvcharts
This is a subclass of IlvAbstractChartFunction
for which the data points are described by a function of the type y = f(x) defined by a script. The script function is retrieved by using its name and the holder of the script context in which the script function is written.
The abscissa of the nth data point of this data set is obtained by the following formula:
x = ((_xMax - _xMin) / (_dataCount -1)) * i + _xMin,
where _xMin
and _xMax
are the minimum and the maximum values for the abscissa, and _dataCount
is the number of data. The ordinate is equal to f(x)
.
IlvScriptChartFunction::IlvScriptChartFunction | ( | const char * | name = 0 , |
|
IlvPointInfoCollection * | ptInfoCollection = 0 | |||
) |
Constructor.
Initializes a new IlvScriptChartFunction
object. The script function name, the holder, and the data count are set to 0
.
The name of the scripting language used to write the script function is also set to 0
. In this case, the scripting language that will be used is the default one. This default language can be obtained by the IlvScriptLanguage::GetDefault
method.
name | If not 0 , this string becomes the name of the created data set. The name passed as a parameter is copied. | |
ptInfoCollection | The object used to manage the point information for the created data set. |
IlvScriptChartFunction::IlvScriptChartFunction | ( | const IlvCoordInterval & | xRange, | |
IlUInt | count, | |||
const char * | scriptFunctionName, | |||
IlvGraphicHolder * | holder, | |||
const IlSymbol * | scriptLanguageName = 0 , |
|||
const char * | name = 0 , |
|||
IlvPointInfoCollection * | ptInfoCollection = 0 | |||
) |
Constructor.
Initializes a new IlvScriptChartFunction
object.
xRange | The interval of values considered for the abscissa. | |
count | The number of considered data points. | |
scriptFunctionName | The name of the script function used to define the data points. | |
holder | The holder that the script context in which the script function is written is associated with. If no holder is specified, the script context that will be used is the global script context. | |
scriptLanguageName | The name of the scripting language used to write the script function. If no name is specified (that means that scriptFunctionName is equal to 0 ), the scripting language that will be used is the default one. This default language can be obtained by the IlvScriptLanguage::GetDefault method. | |
name | If not 0 , this string becomes the name of the created data set. The name passed as a parameter is copied. | |
ptInfoCollection | The object used to manage the point information for the created data set. |
virtual IlvScriptChartFunction::~IlvScriptChartFunction | ( | ) | [virtual] |
Destructor.
The destructor deletes the name of the script function and sets the pointer to the holder stored by the current object to 0
.
Computes the ordinate value of a data point from the abscissa value.
This method calls the defined script function with the parameter x and returns the result of the function in y.
x | The abscissa value of a given data point. | |
y | The computed ordinate of the data point. |
IlTrue
if the call of the script function is successful. Otherwise, it returns IlFalse
. virtual IlvChartDataSet* IlvScriptChartFunction::copy | ( | ) | const [virtual] |
Virtual copy constructor.
Creates and returns a copy of the current object. This method must be overloaded in subclasses. It is automatically declared by the DeclareChartDataSetTypeInfo
macro. The IlvPredefinedChartDataSetIOMembers
macro lets you define a default implementation, which returns an instance initialized with the copy constructor.
Implements IlvChartDataSet.
IlvGraphicHolder* IlvScriptChartFunction::getHolder | ( | ) | const |
Returns the holder in which the script function is defined.
The script function is defined in a given script context. This method returns the holder with which this script context is associated. The holder is used to retrieve the definition of the script function.
virtual void IlvScriptChartFunction::getPoint | ( | IlUInt | i, | |
IlvDoublePoint & | point | |||
) | const [virtual] |
Returns a data point.
Returns in point the point of index i for the current data set. This point is defined as follows:
IlDouble x = ((_xMax - _xMin) / ( _dataCount -1)) * i + _xMin; IlDouble y; if (isFunctionDefined()) callScriptFunction(x, y); else y = _yMin; point.x(x); point.y(y);
where _xMin
and _xMax
are the minimum and the maximum values for the abscissa, _dataCount
is the number of data considered, and _yMin
the minimum value of the ordinate for all the considered data.
i | The index of the returned data point. | |
point | The returned data point. |
Implements IlvChartDataSet.
IlvScriptContext* IlvScriptChartFunction::getScriptContext | ( | ) | const |
Returns the script context in which the script function is defined.
IlvScriptChartFunction::getScriptLanguageName
method or the default scripting language if no name is defined.IlvScriptContext::GetGlobal
method. const char* IlvScriptChartFunction::getScriptFunctionName | ( | ) | const |
Returns the script function name.
const IlSymbol* IlvScriptChartFunction::getScriptLanguageName | ( | ) | const |
Returns the name of the scripting language used to write the script function.
0
if no name is defined.IlvScriptLanguage::GetDefault
method. virtual IlBoolean IlvScriptChartFunction::isFunctionDefined | ( | ) | const [virtual] |
Indicates whether the script function describing the data is defined.
IlTrue
if the script function describing the data is defined and IlFalse
otherwise. Reimplemented from IlvAbstractChartFunction.
void IlvScriptChartFunction::setHolder | ( | IlvGraphicHolder * | holder | ) |
Sets the holder in which the script function is defined.
The script function is defined in a given script context. This method sets the holder with which this script context is associated. The stored holder allows you to retrieve the definition of the script function.
holder | The new holder in which the script function is defined. |
void IlvScriptChartFunction::setScriptFunctionName | ( | const char * | name | ) |
Sets the script function name.
name | The name of the script function used to describe the data points for the considered data set. |
void IlvScriptChartFunction::setScriptLanguageName | ( | const IlSymbol * | name | ) |
Sets the name of the scripting language used to write the script function.
name | The new name of the scripting language used to write the script function. If name is equal to 0 , the scripting language that will be used is the default one. This default language can be obtained by the IlvScriptLanguage::GetDefault method. |
virtual void IlvScriptChartFunction::write | ( | IlvOutputFile & | file | ) | const [virtual] |
Writes the attributes of the current object in a file.
Called by the IlvChartDataSet::save
method. This method can be overloaded in subclasses that define new attributes. The information written by the write
method is read by the IO constructor, which takes an IlvInputFile
as its only argument. Both this method and the IO constructor can be automatically declared by using the DeclareChartDataSetTypeInfo
macro within the class declaration.
file | The file where the attributes of the current object are written. |
Reimplemented from IlvAbstractChartFunction.
© Copyright 2012, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.