Teechart图表教程:序列文本源组件SeriesTextSource

   Steema公司和慧都科技针对中国市场联合推出中文版TeeChart for .NET图表控件,一共汉化2000个词条(17000个单词),汉化文档35000个单词,包括控件设计时与运行时的界面汉化以及控件使用向导文档的汉化,总汉化90%以上!

    TeeChart for .NET中文版让您在使用和学习上没有任何语言障碍,至少可以节省30%的开发时间。TeeChart for .NET中文版具有易上手,使用方便,稳定性好,性价比高,价格优惠等优势,并且针对Web应用提供无限制服务器分发授权方式,非常有利于产品集成。


Teechart组件的应用实例

    Steema为了充分发挥TeeChart页图表组件的功能,将图表编辑器的选项卡进行了拆分,构成独立的可视或非可视组件,由程序设计员根据用户的功能要求进行重新组合,以满足用户需要。

序列文本源组件SeriesTextSource

演示:SeriesTextSource。

功能:演示文本文件作为数据源时该组件的使用方法。从其他途径获得的数据文件以文本形式存储时,利用该组件如何实现图表方式的显示。

设计:

采用文本作为图表组件序列的数据源时可以采用两种途径。

在程序设计阶段

  1. 在窗体拖入图表组件Chart1并增加序列TBarSeries为Series1,然后打开Series选项卡中的DataSource页面,选定数据源为TextFile型,并在下面的Source选项卡中设置文本文件所在位置,如下图1所示。

    图1

    文本数据源路径设置

  2. 选择图1的Fields选项卡,指定文本源中列与序列中的Label、X、Y坐标的对应关系,如图2所示。文本数据源显示在图3中,从图3可以看出,栅格中Column列的数字是文本中的数据所在的列号,例如Column和Text对应的数字2说明序列中的Text就是文本文件的第2列的内容。

    图2

    文本文件列与序列坐标对应关系设置

    图3

    文本数据源

  3. 待有关项设置完成后,单击Apply按钮,这时,就可以在窗口中看到如图5所示的显示结果,如果不理想可重新修改。

  4. 从4中看出,窗口的左上角有一个TSeriesTextSource图标,这是在选中数据源类型为TextFile时系统自动加上去的,同时,在对象观察窗口可看到这个组件的有关设置,如图5所示。

    图4

    文本数据源设计阶段效果

    图5

    文本数据源属性设置

在程序运行阶段

当在程序设计阶段设置文本数据源的属性时,先在窗体中拖入图表组件Chart、序列文本数据源组件SeriesTextSource和打开文件对话框组件OpenDialog,然后在打开文本文件按钮的OnClick事件中加入下列代码:

procedure TForm1.Button2Click(Sender:TObject);
begin
if OpenDialog.Execute then
  begin
  SeriesTextSource1.FileName:=OpenDialog1.FileName;
  SeriesTextSource1.Fieldseparator:=',';
  SeriesTextSource1.HeaderLines:=0;
  SeriesTextSource1.Series:=Series1;
  SeriesTextSource1.Fields[0].FieldIndex:=1;
  SeriesTextSource1.Fields[0].FieldName:='X';
  SeriesTextSource1.Fields[1].FieldIndex: =2;
  SeriesTextSource1.Fields[1].FieldName:='Text';
  SeriesTextSource1.Fields[2].FieldIndex:=3;
  SeriesTextSource1.Fields[2].FieldName:='Bar';
  SeriesTextSource1.Active:=true;
  end;
end;

    在这个例子中使用了 TOpenDialog对话框,采用随时打开文件随时显示的方法显示文本数据源,这样使用起来更方便也更灵活,程序运行效果如图6所示。

图6

打开文本数据源的运行效果

技巧:

本例的关键步骤是:

  1. 设置数据源格式为文本文件Text File

  2. 指定文本文件路径、文件名。

  3. 指定文本文件头信息占用的函数,即说明数据从文本文件的第几行开始。

  4. 数据列的分隔符(逗号、空格、Tab)。

  5. 序列中的 Label、X、Y与文本文件列的对应关系。

界面:

    程序设计和运行阶段的界面如图6所示。由于设计阶段和运行阶段对SeriesTextSource的设置是一样的,所以,设计阶段和运行阶段的显示效果是一样的。

    下一节我们将会介绍Teechart组件的应用实例:XML数据源组件ChartWebSource。将会有演示,功能,设计,技巧和界面五个方面的介绍。如果有对Teechart图表感兴趣的朋友,可以多多关注本教程,并且欢迎在评论区留言。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
=========================== TeeChart Pro v8 VCL / CLX 100% Full Source Code Steema Software SL http://www.steema.com info@steema.com --------------------------- Thank You for Registering TeeChart Pro Source code. The source code can be modified or expanded for your own compiled applications. You can not resell or redistribute in any way this source code as it is or modified. See the License.txt document for complete licensing and disclaimer issues. Recompiling Packages: ---------------------- Kylix: ------ Please follow the installation guidelines found at Kylix.txt file. Borland Developer Studio 2006, Delphi 2005.NET and Delphi 8 for .NET: -------------------------------------- Open the Steema.TeeChart.VCL project group: Steema.TeeChart.VCL.bdsgroup and build all projects. .NET Destination of runtime packages: ------------------------------------- You might optionally want to install TeeChart for VCL.Net assemblies (packages) into .NET Framework "GAC" (Global Assembly Cache): gacutil /i Steema.TeeChart.VCL.dll gacutil /i Steema.TeeChart.VCL.Languages.dll gacutil /i Steema.TeeChart.VCL.Design.dll .NET Installation: ------------------ Under Delphi .NET, go to Component->Installed .NET Components and browse and select the Steema.TeeChart.VCL.Design.dll assembly (design-time package for VCL Forms applications). Delphi / C++ Builder: --------------------- In Delphi and C++ Builder you can recompile the TeeChart Pro packages opening the appropiate Project Group File (*.bpg) BDS 2006: Tee8D10.bpg Delphi 2005: Tee8D9.bpg Delphi 7: Tee8D7.bpg Delphi 6: Tee8D6.bpg Delphi 5: Tee8D5.bpg Delphi 4: Tee8D4.bpg C++ Builder 6: Tee8BCB6.bpg C++ Builder 5: Tee8BCB5.bpg C++ Builder 4: Tee8BCB4.bpg Double-click the first package ( ie: Tee89 ) and select "Project -> Build All packages" to recompile all packages. Please remove old package files and close all projects before recompiling. Destination of runtime packages: -------------------------------- \Windows\System (\WinNT\System32) : Teexx.bpl TeeDBxx.bpl TeeUIxx.bpl TeeGLxx.bpl TeeQRxx.bpl TeeProxx.bpl TeeImagexx.bpl TeeLanguagexx.bpl Installation of packages: -------------------------- Under Delphi / C++ Builder IDE, select Component->Install Packages. Make sure older TeeChart packages are removed from the package list. Select and Add the following design-time packages: For BDS 2006 and Delphi 2005: DclTeeProxx.bpl For all other Delphi and C++Builder versions: DCLTeexx.bpl DCLTQRxx.bpl DCLTeeProxx.bpl DCLTGLxx.bpl and: \Windows\System\TeeImagexx.bpl Installation errors: --------------------- Problems when installing packages in Delphi / C++ Builder arise when old or duplicate *.bpl (*.dpl) files are still located in the system path (\Windows\System or \WinNT\System32). Other causes are: -Improper modification of source code. -Old or duplicate *.DCP or *.DCU or *.OBJ files. Modifications: -------------- If you modify TeeChart Pro source code or fix a bug, you can email us this info so we can apply the same changes for next coming upgrades if they can benefit to other programmers. Support: -------- Please direct your questions to our Support Central Web Site: http://support.steema.com ------------------------------------------------------------- Thanks for TeeCharting ! Steema Software www.steema.com
=============================================== TeeChart Pro v2013 Copyright (c) 1995-2013 by Steema Software All Rights Reserved =============================================== SOFTWARE LICENSING CONTRACT NOTICE TO USER: THIS IS A CONTRACT. BY CLICKING THE 'OK' BUTTON BELOW DURING INSTALLATION, YOU ACCEPT ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT. =========================================== License Terms: =============== -- A Single License of TeeChart Pro VCL is per developer. -- A Site License of TeeChart Pro VCL is per "physical place" with unlimited number of developers under the same company building(s). -- For special licensing issues, volume discounts, integrations or redistribution please contact us at: sales@steema.com TeeChart Pro is royalty free under the following use conditions ================================== You can freely distribute TeeChart Pro code COMPILED into your applications as executables or dynamic link libraries, including as OCX ActiveX Controls or ActiveX Forms, excepting compilation as design-time packages or compilation into a DLL or OCX for use in a Web server scripting environment. The latter case requires that a WebServer runtime license be registered per installed server. You are NOT allowed to distribute stand-alone TeeChart Pro files, TeeChart Pro source code, TeeChart Pro manual and help file or everything else contained in this software without receiving our written permission. You are NOT allowed to distribute the TeeChart design-time package files and/or any of the TeeChart *.DCP or any other file from the source code files. You can freely distribute the TeeChart evaluation version, located at our web site http://www.steema.com END-USER LICENSE AGREEMENT FOR STEEMA SOFTWARE SL IMPORTANT- READ CAREFULLY BEFORE INSTALLING THE SOFTWARE. This End User License Agreement (this "EULA") contains the terms and conditions regarding your use of the SOFTWARE (as defined below) and material
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值