如何控制讓TChart的資料每次只顯示10筆,不要顯示所有資料? |
尚未結案
|
nlj859
資深會員 發表:139 回覆:375 積分:322 註冊:2004-03-20 發送簡訊給我 |
我使用TChart的元件去繪製圖表,但是資料我會每一秒都產生,但是一直run時,他不會只限定10筆的數據,他會一直的堆上去...
請問哪裡可以設定讓它只顯示最新的10筆資料?或是怎麼用程式去控制?
另外,我要每次所繪製的線都變顏色,但他每次都是固定的一種研色而且,為何會這樣?(我是使用Fast Line,但其它像圓餅圖就沒有問題)
請指導一下,謝謝.
我的範例code如下:
void __fastcall TForm1::Timer1Timer(TObject *Sender) { TColor cl; i ; switch (random(3)) { case 0: cl=clRed; break; case 1: cl=clGreen; break; case 2: cl=clBlue; } Series1->Add(random(2000),i,cl); }發表人 - nlj859 於 2004/07/24 13:15:27 |
GGL
資深會員 發表:104 回覆:600 積分:335 註冊:2006-11-05 發送簡訊給我 |
|
nlj859
資深會員 發表:139 回覆:375 積分:322 註冊:2004-03-20 發送簡訊給我 |
|
andychang1690
資深會員 發表:20 回覆:694 積分:442 註冊:2003-03-14 發送簡訊給我 |
void __fastcall TForm1::Timer1Timer(TObject *Sender) { TColor cl; i ; switch (random(3)) { case 0: cl=clRed; break; case 1: cl=clGreen; break; case 2: cl=clBlue; } if (Series1->LastValueIndex == 10) { Series1->Delete(0); Series1->AddXY(i,random(2000),IntToStr(i),cl); } else Series1->Add(random(2000),IntToStr(i),cl); } 請參考Andy Chang
------
Andy Chang |
nlj859
資深會員 發表:139 回覆:375 積分:322 註冊:2004-03-20 發送簡訊給我 |
|
andychang1690
資深會員 發表:20 回覆:694 積分:442 註冊:2003-03-14 發送簡訊給我 |
nlj859你好:
我只是先依你的程式告訴你如何顯示限制十筆的資料
BCB的HELP對Fast Line 描述如下 TFastLineSeries Component The TFastLineSeries component is an extremely simple Series component that draws its points as fast as possible. To see a visual representation of this Series type, go to the TeeChart User Guide. It can be used in cases where speed is the most important needed feature. TFastLineSeries has no clicking support and no Marks. Set the ParentChart property to the desired Chart component. To add points to the Series use the standard AddY or AddXY methods. Right-click the component at design-time to access the DataSource Wizard Dialog to connect the Series to another Series or to any Table or Query component. The only extra property is the LinePen property, which controls the line appearance. Please refer to TChartSeries ancestor description for all common Series properties like Axis dependence and events. Line Series here are 2 line Series types available, Line and Fast Line. Which one should be used ? Fast line is just what its name describes - it is fast. It is distinct from Line because to achieve speed - speed to add new points to the Series - the price paid is that it foregoes some properties that the Line Series has. See the section on Fast Line for a description of those differences. Fast line
See TFastLineSeries for a full list of properties and methods This line Series draws only at 2 Dimensions but draws very quickly - performance will depend on your hardware - The Series type was originally conceived to tackle high volume requirements of technical and financial applications but serves well for any dataset of very high point volumes.
If, when using Fast Line you know approximately how many data points will be added to your Series you could use the global variable TeeDefaultCapacity to prepare memory. For example, assuming a data Series of 10,000 you should set TeeDefaultCapacity to 10,000. This will, in one pass, allocate memory to populate the whole Series replacing the need to incrementally allocate memory which costs more time. 勸你改成TLineSeries
請參考 Andy Chang
------
Andy Chang |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |