翻譯|使用教程|編輯:王香|2019-05-29 14:38:26.023|閱讀 520 次
概述:TeeChart Pro功能是一個系列,幾乎可以是任何系列類型,應(yīng)用代數(shù)函數(shù),數(shù)據(jù)源是另一個圖表系列。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關(guān)鏈接:
已加入在線訂購,現(xiàn)在搶購可立享特別優(yōu)惠!!!
TeeChart Pro功能是一個系列,幾乎可以是任何系列類型,應(yīng)用代數(shù)函數(shù),數(shù)據(jù)源是另一個圖表系列。
所有函數(shù)都派生自TTeeFunction組件并繼承TeeFunction的Period屬性。
TeeChart Pro包含以下預(yù)定義功能列表。有關(guān)所有功能類型的完整列表,請參閱TeeChart Editor Gallery和Helpfile:
函數(shù)類別 | 導(dǎo)入數(shù)量 | 描述 |
Add | 無限 | 繪制輸入的總和 |
Average | 無限 | 平均函數(shù)將計算每組Period點的平均值 |
Bollinger | 1 | 布林線函數(shù)使用簡單或指數(shù)移動平均線來構(gòu)建布林線交易區(qū)間 |
Copy | 1 | 輸入系列的直接副本 |
Curve Fitting | 1 | 使用TypeFitting公式通過數(shù)據(jù)輸入繪制擬合多項式 |
Divide | 無限 |
分割函數(shù)繪制輸入按包含的降序劃 |
Exponential Average | 1 | 基于權(quán)重的指數(shù)平均值 |
Exponential Moving Average | 1 | 基于權(quán)重的指數(shù)移動平均線 |
Exponential Trend | 1 | 通過輸入系列中的點繪制最佳指數(shù)趨勢 |
High | 無限 | 高功能繪制高輸入點 |
Low | 無限 | 低功能繪制低輸入點 |
MACD | 1 | 移動平均收斂分歧 |
Momentum | 1 | 每個Y值是當(dāng)前點的Y值減去最后一個Period點的Y值 |
Momentum Division | 1 | 每個Y值是當(dāng)前點的Y值除以最后一個Period點的YValue,以百分比表示 |
Moving Average | 1 | 移動平均線功能將計算每組周期點的簡單或加權(quán)平均值 |
Multiply | 無限 | 乘法函數(shù)繪制輸入值的乘積 |
Root Mean Square | 無限 | 均方根函數(shù)繪制輸入的RMS值 |
Relative Strength Index | 1 | RSI函數(shù)根據(jù)財務(wù)數(shù)據(jù)計算百分比值。根據(jù)TRSISyle類型,將使用不同的公式來計算RSI值 |
Standard Deviation | 1 | 映射每組Period點的標(biāo)準(zhǔn)偏差(或完全標(biāo)準(zhǔn)差) |
Stochastic | 1 | |
Subtract | 無限 | 繪圖的輸入值按包含的降序減去 |
Trend | 1 | 通過輸入系列點繪制最佳趨勢線 |
多種函數(shù)類型僅支持一個輸入系列。但是,可以鏈接鏈接函數(shù),例如,將圖表中多個系列的平均值創(chuàng)建為平均函數(shù)系列,然后使用平均函數(shù)作為趨勢函數(shù)的輸入來標(biāo)識平均值的趨勢。
使用圖表編輯器,在“第一個圖表”頁面上,選擇“添加”按鈕,就像將新系列添加到圖表一樣。在TeeChart Gallery中,選擇Functions選項卡以選擇所需的功能。每個功能都顯示為一個系列,您可以稍后通過選擇第一個圖表頁面上的更改按鈕來更改與該功能關(guān)聯(lián)的系列類型。之后,在函數(shù)系列的“數(shù)據(jù)源”頁面上可以輕松更改函數(shù)定義。在這里,同樣容易,您可以將已添加到Chart的正常Series的定義更改為Function的定義(Function實際上是數(shù)據(jù)源的定義,而不是Series Type的定義)。
下圖顯示了編輯函數(shù)時的“數(shù)據(jù)源”頁面。線系列(名稱“Series2”,標(biāo)題“平均”)被定義。數(shù)據(jù)源頁面底部的左側(cè)列表框顯示了可用于輸入的圖表中的其他系列(此處為“Series1”)。
假設(shè)我們從一個完全空的Chart開始,這里是代碼中構(gòu)建一個簡單的Series-Function相關(guān)Chart的步驟。
procedure TForm1.BitBtn5Click(Sender: TObject); var 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;
我們可以添加另一個函數(shù)來告訴我們有關(guān)前一個函數(shù)的信息
procedure TForm1.BitBtn6Click(Sender: TObject); var tmpHighLine : TLineSeries; begin //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;
上一節(jié)中的示例重點介紹了使用Datasource按代碼對函數(shù)進(jìn)行內(nèi)容處理。Series使用Datasource定義Function的輸入或定義Series TDataset數(shù)據(jù)源(請參閱有關(guān)訪問數(shù)據(jù)庫的教程)。
使用圖表編輯器,在添加函數(shù)后,函數(shù)系列的“數(shù)據(jù)源”頁面將顯示包含在函數(shù)定義中的可用系列列表。在這里,您可以更改要應(yīng)用于系列的功能類型,并從左側(cè)列表框“可用”中選擇系列,并將它們添加到右側(cè)列表框“已選擇”;。
按代碼的數(shù)據(jù)源使用Series.Datasource屬性。
假設(shè)我們在圖表中有2個數(shù)據(jù)系列。我們使用圖表編輯器添加由2系列的平均值組成的函數(shù):
我們?yōu)?系列添加點數(shù):
var t : Integer; For t := 0 To 10 do begin Series1.Add(2 * t); Series2.Add(3 * t); end;
請注意,該功能不會顯示。您需要使用Series.CheckDatasource方法讀取Function的值。
Series3.CheckDataSource; //Read in data for Function
可以使用Setfunction方法在運行時更改函數(shù)定義,以便為Series分配新函數(shù)。
Series3.Setfunction(TMovingAverageFunction.Create(self));
使用上面的代碼行,Setfunction將Series3的Function更改為Moving Moving。
未完待續(xù)...
購買TeeChart Pro VCL/FMX正版授權(quán),請點擊“”喲!
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請郵件反饋至chenjj@ke049m.cn
文章轉(zhuǎn)載自: