原創(chuàng)|使用教程|編輯:郝浩|2013-04-25 11:32:59.000|閱讀 631 次
概述:本教程就為大家提供幾種,老牌圖表控件TeeChart Pro VCL可以確保數(shù)據(jù)繪制速度的方法。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關(guān)鏈接:
所謂實時數(shù)據(jù)圖,就是圖表中的數(shù)據(jù)與圖表的生成為同一瞬間。當然這是非常理想化的,在現(xiàn)實中,只有提高繪圖速度,盡可能減少測量和繪制數(shù)據(jù)之間的延遲,本教程就為大家提供幾種,老牌圖表控件TeeChart Pro VCL可以確保數(shù)據(jù)繪制速度的方法。
以下方法都可以加快繪制實時數(shù)據(jù)圖的時間:
圖表中的每個元素的繪制都會增加繪制圖表的時間,所以隱藏所有不必要的圖表元素對TeeChart Pro VCL繪制實時數(shù)據(jù)圖是意義重大的。
可以禁用的不必要元素包括圖表圖例,圖表標題,圖表框架等。
還可以手動定義圖表軸的遞增單位和軸范圍,這樣可以避免被執(zhí)行的內(nèi)部calculatation算法過于頻繁。
此外,還可以使用一個從TeeChart V6版本后開始引入的新屬性——TChartAxes.FastCal。把這個屬性設(shè)置為True后,他額外的減少圖表的繪制時間。
下面這個代碼示例中就包括上述所提到的所有屬性和方法設(shè)置。
// Prepare chart for maximum speed: with Chart1 do begin ClipPoints := False; Title.Visible := False; Legend.Visible := False; LeftAxis.Axis.Width:=1; BottomAxis.Axis.Width:=1; BottomAxis.RoundFirstLabel := False; View3D := False; end; // Number of points we'll be displaying MaxPoints:=10000; // Number of points deleted when scrolling chart ScrollPoints := 5000; // Prepare series. // Disable AutoRepaint and X Order // AutoRepaint=False means "real-time" drawing mode. // Points are displayed just after adding them, // without redrawing the whole chart. Series1.AutoRepaint := False; // Set Ordering to none, to increment speed when adding points Series1.XValues.Order := loNone; // Initialize axis scales // we're assuming left axis values are within [0,1000] Chart1.LeftAxis.SetMinMax(0,10000); Chart1.BottomAxis.SetMinMax(1,MaxPoints); // Speed tips: // When using only a single thread, disable locking: Chart1.Canvas.ReferenceCanvas.Pen.OwnerCriticalSection := nil; Series1.LinePen.OwnerCriticalSection := nil; // For Windows NT, 2000 and XP only: // Speed realtime painting with solid pens of width 1. Series1.FastPen := True; // Set axis calculations in "fast mode". // Note: For Windows Me and 98 might produce bad drawings when // chart zoom is very big. Chart1.Axes.FastCalc := True;
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉(zhuǎn)載自:慧都控件網(wǎng)