rwlogo
Rogue Wave Views 5.6

Rogue Wave Views
Charts Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

IlvScriptChartFunction Class Reference

Class for data sets described by a script function. More...

#include <ilviews/charts/scriptft.h>

Inheritance diagram for IlvScriptChartFunction:
IlvAbstractChartFunction IlvChartDataSet

List of all members.

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 IlvChartDataSetcopy () const
 Virtual copy constructor.
IlvGraphicHoldergetHolder () const
 Returns the holder in which the script function is defined.
virtual void getPoint (IlUInt i, IlvDoublePoint &point) const
 Returns a data point.
IlvScriptContextgetScriptContext () const
 Returns the script context in which the script function is defined.
const char * getScriptFunctionName () const
 Returns the script function name.
const IlSymbolgetScriptLanguageName () 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.

Detailed Description

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

See also:
IlvAbstractChartFunction, IlvPointInfoCollection, IlvGraphicHolder, IlvScriptContext.

Constructor & Destructor Documentation

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.

Parameters:
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.

Parameters:
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.


Member Function Documentation

IlBoolean IlvScriptChartFunction::callScriptFunction ( IlDouble  x,
IlDouble y 
) const

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.

Parameters:
x The abscissa value of a given data point.
y The computed ordinate of the data point.
Returns:
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.

Returns:
A copy of the current object.

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.

Returns:
The holder in which the script function is defined.
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.

Parameters:
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.

Returns:
The script context in which the script function is defined. The script context is obtained by using the stored holder. Several script contexts may be associated with the holder. The returned script context is the script context using the scripting language whose name is returned by the IlvScriptChartFunction::getScriptLanguageName method or the default scripting language if no name is defined.
If no holder is defined, the returned script context is the global one that can be obtained by a call to the IlvScriptContext::GetGlobal method.
const char* IlvScriptChartFunction::getScriptFunctionName (  )  const

Returns the script function name.

Returns:
The name of the script function used to describe the data points for the considered data set. You must not modify or delete the returned string.
const IlSymbol* IlvScriptChartFunction::getScriptLanguageName (  )  const

Returns the name of the scripting language used to write the script function.

Returns:
The name of the scripting language used to write the script function or 0 if no name is defined.
Warning:
[note] If no name of scripting language is defined, the scripting language that will be used is the default one. This default language can be obtained by the IlvScriptLanguage::GetDefault method.
virtual IlBoolean IlvScriptChartFunction::isFunctionDefined (  )  const [virtual]

Indicates whether the script function describing the data is defined.

Returns:
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.

Parameters:
holder The new holder in which the script function is defined.
void IlvScriptChartFunction::setScriptFunctionName ( const char *  name  ) 

Sets the script function name.

Parameters:
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.

Parameters:
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.

Parameters:
file The file where the attributes of the current object are written.

Reimplemented from IlvAbstractChartFunction.

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

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