ComponentOne Chart for .NET (2.0) Search HelpCentral 

Using a Code String to Define a Function

When an interpretive code string is used to define a function of a function class (YFunction or ParametricFunction), the string is compiled and the resulting code is dynamically included into the application. Execution speed will be the same as any other compiled code.

This provides a number of advantages which among others include:

·      Built-in functions of C# or VB can be used when defining the function.

·      Functions can be built by simple manipulation of strings.

·      Functions are saved as part of the chart layout using the SaveChartToFile() or SaveChartToString() methods, and can be loaded directly into other projects as part of the data.

There are however, disadvantages as well, which among others include:

·      Time delay when first assigning or changing code text due to pre-compilation.

·      Types of source code limited to C# or VB.

For simple, one-variable explicit functions, the YFunction class object is used. This object has one code property, CodeText. For YFunction objects, the independent variable is always assumed to be “x”.

For parametric functions, a pair of equations must be defined using the ParametricFunction class object. This object has two properties, one for each coordinate. The properties, CodeTextX and CodeTextY accept code in which the independent variable is always assumed to be “t”.

For both class objects, the values of the independent variable are assumed to be uniformly distributed from the minimum to the maximum value of the independent variable, using the specified number of data points specified by the PlotNumPoints property.

Depending on complexity of function, three types of code are supported for CodeText, CodeTextX and CodeTextY. The code types include Formula, Method and Unit, each of which is described in the following section.


Formula Code Types

Method Code Types

Unit Code Types


Send comments about this topic to ComponentOne.
Copyright © ComponentOne LLC. All rights reserved.