TeeChart Pro VCL / FMX tutorial use the function

  Function Type

  Function Features

  TeeChart Pro function is a series, the series can be almost any type of algebraic functions, the data source is a graph of another series.

  All functions are derived from TTeeFunction components and inherit property TeeFunction the Period.

  TeeChart Pro includes the following predefined list of features. For a complete list of all types of functions, see TeeChart Editor Gallery and Helpfile:

  Import function category Number Description

  Add the infinite sum drawing input

  Unlimited Average Average function calculates the average of each point Period

  Bollinger Bollinger1 simple function with or EMA constructed Bollinger trading range

  Copy1 direct copy of the input series

  Curve Fitting1 TypeFitting equation through the data input using polynomial fitting drawing

  Divide the partition function Unlimited drawing input stroke contained in descending order

  Exponential Average1 weight-based index average

  Exponential Moving Average1 weight based on the moving average of the index

  Exponential Trend1 draw the best exponential trend by entering a series of points

  High infinitely high input function to draw high point

  Low unlimited low-input function to draw low point

  MACD1 moving average convergence divergence

  Momentum1 each Y value is the current value of the point Y Y subtracting a value of the last point of Period

  Momentum Division1 each Y value is divided by the current value of the point Y Period last point YValue, expressed as a percentage

  Moving Average1 moving average calculating function simple or weighted average of each point period

  Infinite multiplication product of the input value plotted as a function Multiply

  Unlimited rms Root Mean Square plotted as a function of the RMS value of the input

  Relative Strength Index1RSI function to calculate a percentage value based on the financial data. The TRSISyle type, using a different formula to calculate the value of RSI

  Standard Deviation1 standard deviation mapping each point Period (fully or standard deviation)

  Stochastic1

  Subtract the input values ​​in descending order infinite drawing comprises subtracting

  Trend1 best draw series input point by trendline

  Multiple function type supports only one input series. However, you can link link function, for example, will create a chart in the average number of series for the average family of functions, then use the average function to identify trends in the average trend as an input function.

  Add Function

  Use the diagram editor, on the "first chart" page, select the "Add" button, just add a new series to chart the same. In TeeChart Gallery, select the Functions tab to select the desired function. Each function is shown as a series, you can select the Change button on the first page later to change the chart type series associated with the function. Then, in the "Data Source" page function series can easily change the function definition. Here, just as easily, you can have added to the definition of normal Series of Chart Change Function definition (Function is actually defined data source, rather than defining the Series Type).

  The following figure shows the "Data Source" page when editing function. Line series (the name "Series2", the title "average") is defined. Box at the bottom left of the list page displays the data sources can be used to chart the other series input (here, "Series1").

  Suppose we Chart from the start of a completely empty, where the code is constructed in a simple Series-Function Chart related steps.

  procedure TForm1.BitBtn5Click(Sender: TObject);

  was tmpBarSeries1,

  tmpBarSeries2 : TBarSeries;

  tmpLineSeries : TLineSeries;

  begin

  //Add 2 data Series

  tmpBarSeries1:=TBarSeries.Create(Self);

  tmpBarSeries2:=TBarSeries.Create(Self);

  AddSeries(tmpBarSeries1);

  AddSeries(tmpBarSeries2);

  //Populate them with data (here random)

  tmpBarSeries1.FillSampleValues(10);

  tmpBarSeries2.FillSampleValues(10);

  //Add a series to be used for an Average Function

  tmpLineSeries:=TLineSeries.Create(Self);

  AddSeries(tmpLineSeries);

  //Define the Function Type for the new Series

  tmpLineSeries.SetFunction(TAverageTeeFunction.Create(Self));

  //Define the Datasource for the new Function Series

  //Datasource accepts the Series titles of the other 2 Series

  tmpLineSeries.DataSources.Clear;

  tmpLineSeries.DataSources.Add( tmpBarSeries1 );

  tmpLineSeries.DataSources.Add( tmpBarSeries2 );

  // *Note - When populating your input Series manually you will need to

  // use the Checkdatasource method

  // - See the section entitled 'Defining a Datasource'

  //Change the Period of the Function so that it groups averages

  //every 2 Points

  tmpLineSeries.FunctionType.Period := 2;

  end;

  We can add another function to tell us about the previous function

  procedure TForm1.BitBtn6Click(Sender: TObject);

  was tmpHighLine: TLineSeries;

  begin  Wuxi Women's Hospital Which is good http://www.xasgyy.net/

  //Add another Series to be used for a 2nd Function

  tmpHighLine:=TLineSeries.Create(Self);

  AddSeries(tmpHighLine);

  //Define the Function Type for the new Series

  tmpHighLine.SetFunction(THighTeeFunction.Create(self));

  //Define the Datasource for the new Function Series

  //Use the existing Function (tmpLineSeries) as input

  //You should declare tmpLineSeries globally to the module

  //if you wish to use it between procedures

  tmpHighLine.DataSource := tmpLineSeries;

  //Leave the Period at default 0 (No Period set) to draw

  //A line at Highest of all points of the Average Function

  end;

  Define the data source

  Focus on an example of use described by Datasource content processing function code. Series use Datasource defined Function input or definitions Series TDataset data source (see Tutorial on accessing the database).

  Use diagram editor, after adding function, the function of the series of "Data Source" page included in the list of available series function definition. Here, you can change the function of the type of series you want to apply, and "available" in select series and add them to the right list box "Selected" from the left list box;.

  Series.Datasource attribute data used by the source code.

  Suppose we have two data series in the chart. We use the chart editor to add a function by the average of the two series consisting of:

  We add 2 Series Points:

  where t Integer;

  For t := 0 To 10 do

  begin

  Series1.Add(2 * t);

  Series2.Add(3 * t);

  end;

  Please note that this feature will not be displayed. You need to use Series.CheckDatasource method to read the value of Function.

  Series3.CheckDataSource; //Read in data for Function

  You can change the function definition at runtime using Setfunction method to assign a new function for the Series.

  Series3.Setfunction(TMovingAverageFunction.Create(self));

  Using the above line of code, Setfunction Series3 will change the Function to Moving Moving.

Guess you like

Origin www.cnblogs.com/djw12333/p/10958713.html