使用跨平台图表控件TeeChart如何从DAT或TEXT文件中导入数据
大多数开发人员在使用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(,);
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;
使用跨平台图表控件TeeChart如何从DAT或TEXT文件中导入数据的更多相关文章
- 跨平台图表控件TeeChart使用教程:导入XML数据
TeeChart的最新版中包含了一个自动加载XML数据的新组件.这个组件的名字叫做TTeeXMLSource,用户可以在TeeXML.pas unit中找到这个组件. 加载XML图表所需的最小属性是& ...
- 跨平台图表控件TeeChart使用教程:将图表数据导出为XML格式
在开发者使用TeeChart进行开发的过程中,不管是在设计时或者运行时都可以使用的图表导出对话框将图表数据轻易地导出为XML格式: TeeChart最新版那下载地址 上图为TeeChart导出对话框的 ...
- 8.5折!图表控件TeeChart特价中...
著名图表控件TeeChart去年除了在优势的.NET方面表现依旧出色外,还推出了通过Xamarin和MONO实现的Android,iOS和Mac OSX的跨平台方案,让C#开发者也能开发移动APP. ...
- Flash图表控件FusionCharts如何高亮显示数据
使用Flash图表控件FusionCharts时,通过改变alpha值是高亮显示数据的最简单方式. XML代码如下: <chart> <set label='John' value= ...
- 图表控件Anychart常见问题
AnyChart控件是一款当前流行的数据可视化解决方案,使客户可以创建交互地.生动的图表.实时仪表和地图.同时支持Flash和HTML5显示,控件提供极好的视觉外观和配色方案能够使客户根据不同的需求设 ...
- ASP.NET Core MVC TagHelper实践HighchartsNET快速图表控件-开源
ASP.NET Core MVC TagHelper最佳实践HighchartsNET快速图表控件支持ASP.NET Core. 曾经在WebForms上写过 HighchartsNET快速图表控件- ...
- 比achartengine更加强大的Android图表控件。
比achartengine更加强大的图表控件MPAndroidChart. 详细使用及demo:http://www.see-source.com/androidwidget/detail.html? ...
- 在AngularJS中的使用Highcharts图表控件
一.Highcharts简介 Highcharts是一款非常好用的前端图表控件,正如其中文网介绍的那样:功能强大.开源.美观.图表丰富.兼容绝大多数浏览器的纯js图表库. 如果你的项目是基于jquer ...
- HighchartsNET快速图表控件-开源
前言: HighchartsNET快速图表控件,基于Highcharts的asp.net web控件.只需几行代码你就能快速生成一个图表. 从此不再担心图表复杂.简单几行代码就可以搞定,节省大量工作时 ...
随机推荐
- HashMap resize导致死循环
原文链接:https://blog.csdn.net/hll174/article/details/50915346 问题的症状 从前我们的Java代码因为一些原因使用了HashMap这个东西,但是当 ...
- javascript事件委托//就是父级事件给子级
<!DOCTYPE html><html><head> <title></title> <style type="text/ ...
- ArcGIS api for javascript-图层控制(图层树)
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content ...
- Job for postfix.service failed because the control process exited with error code. See "systemctl status postfix.service" and "journalctl -xe" for details.
这是因为防火墙或者配置文件导致,无法启动的邮件服务!! 首先关闭防火墙! 修改配置文件 vim /etc/postfix/main.cf inet_protocols = ipv4 inet_inte ...
- git 日常使用从入门到真香
目录 git 日常使用从入门到真香 一.Git简介 二.Git常用命令 三.git操作流程 四.报错处理 git 日常使用从入门到真香 一.Git简介 Git是一个开源的分布式版本控制系统,可以有效. ...
- eclipse项目中的java文件导入后变为空心J问题
1,选择工程名字右键——>属性——>JavaBuild Path会看到右侧Source标签中为空白 2,点击Add Folder...选择如图所示的src包和相关的配置文件包,点击确定: ...
- $.ajax 错误信息
$.extend({ getHtml:function(url,callback){ $.ajax({ dataType:"html", url:url, timeout:1500 ...
- Codeforces - 440C DFS
搜索苦手,注意正负 #include<bits/stdc++.h> #define rep(i,j,k) for(int i = j; i <=k; i++) using names ...
- Java的观察者
class Teacher extends Observable { public void startLesson() { System.out.println(String.format(&quo ...
- 【ACM】懒省事的小明
懒省事的小明 时间限制:3000 ms | 内存限制:65535 KB 难度:3 描述 小明很想吃果子,正好果园果子熟了.在果园里,小明已经将所有的果子打了下来,而且按果子的不同种 ...