大多数开发人员在使用TeeChart进行开发的时候,都需要访问包含在文本文档中的一些数据,本次教程将详细讲解如何去实现这一步骤。
文本文件通常包含使用空格键或者是TAB键分隔开的数字和文字:
TeeChart官方最新版免费下载地址
比如下面的文本,包含两个字段,使用空格作为字段分隔:
0.1 24
0.5 143
0.2 321
0.1 100
从一个文本文件读取数据(如果列分隔符是正确的),开发者可以使用TSeriesTextSource组件,可以根据自身的数据设置ileName、Fields和FieldSeparator属性。然后只需通过设置TSeriesTextSource.Series或Series.DataSource属性将系列文本源组件连接到一个图表系列。
1 创建一个新的应用程序。 (File->New->Application)
2 从"Additional"面板选项卡中拖放TChart组件。
3 双击Chart1组件显示TeeChart编辑对话框。(或右键单击Chart1并单击"Edit...")
4 单击"Add..." 按钮,选择"Line"系列风格,单击OK按钮。(或双击"Line"图表)
5 关闭编辑器对话框(或按Esc键关闭它)。
6 找到“TeeChart”组件面板选项卡并拖放SeriesTextSource组件。
7 双击SeriesTextSource1组件显示编辑器对话框,填写以下属性:
VCL代码:
unit UImportData; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, TeEngine, Series, TeeURL, TeeSeriesTextEd, ExtCtrls, TeeProcs, Chart, StdCtrls, Buttons; type TForm1 = class(TForm) Chart1: TChart; Series1: TLineSeries; SeriesTextSource1: TSeriesTextSource; Panel1: TPanel; BitBtn1: TBitBtn; procedure BitBtn1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.BitBtn1Click(Sender: TObject); begin with SeriesTextSource1 do begin // Setup fields (columns in text file) Fields.Clear; AddField('X',1); AddField('Y',2); // Set separators FieldSeparator := ' '; DecimalSeparator := '.'; // Set file name containing text data FileName := 'test.dat'; // Series to add data Series := Series1; // Load data from file into Series Active := True; end; // Example of setting axes scales. // Not necessary is axes already have Automatic:=True. Series1.GetVertAxis.SetMinMax(0,1); Series1.GetHorizAxis.SetMinMax(3864.90,3865.50); end; end. Displaying the SeriesTextSource editor dialog If you wish to show the SeriesTextSource editor dialog at runtime, simply drop a button and type this code at Button1Click event: procedure TForm1.Button1Click(Sender: TObject); begin // This procedure is located at TeeSeriesTextEd.pas unit: TeeEditSeriesTextSource(SeriesTextSource1); end;
相关推荐
图表控件TeeChart5 OCX, 可直接在IDE中调用,TeeChart是一个支持多种开发平台与语言(VB、VC、Delphi...)的图表制作控件, 可以帮助你更快更好的开发图表制作类程序。
图表控件TeeChart破解版,支持VC6.0、VS2010等编译器。
VS2010下利用TeeChart控件写xml文件数据,并读文件数据到控件中显示。
Teechart是Teechart for .NET、TeeChart Pro ActiveX V2010等控件的简称,是由Steema公司研发的一系列图表控件的简称。
TeeChart Pro ActiveX是西班牙Steema SL公司开发的图表类控件,主要用来生成各种复杂的图表。熟悉Delphi和C++ Builder的编程人员对它不会陌生,因为在Delphi和C++ Builder里包括了TeeChart的VCL版本。本文使用的...
TeeChart8.ocx图表控件(含注册)汉化版 EXE文件,运行后,自动注册。
绘图控件TeeChart的功能介绍与应用举例
TeeChart控件 TeeChart.dll
这个实例还不错 希望对你有帮助
这是TeeChart控件破解版,可直接安装,不受试用期限制
vs c++安装图表插件teechart8操作步骤及64组件vs c++安装图表插件teechart8操作步骤及64组件
文件/文件夹说明: TeeChart for .NET导入导出功能_慧都控件网.mp4:官方视频 tee文件夹:官方tee文件和笔者的tee文件 TeeChart导出tee数据文件(支持导入).rar:C# WinForm导出/导入tee数据文件例子
VC中使用Teechart控件的用法
我们很容易找到基于VS的Teechart组件及其使用说明,但这是一份基于vc6的。
功能强大的vs2005图表控件破解版,将dll文件引用来项目中即可使用。
在vs工具箱中可直接添加使用,添加成功后和其他控件一样在工具箱中拖出使用,控件中包含各种类型的图表控件,根据自己的需要使用。
单文件破解版,工具箱上点右键,添加选项卡->选择项->选择teechart.dll确定,即可添加到工具箱。