TChart-XML數據源演示

来源:https://www.cnblogs.com/adsoft/archive/2020/03/03/12404776.html
-Advertisement-
Play Games

首先提供兩個XML文件 XML代碼如下: 1、Example.xml <?xml version="1.0" encoding="ISO-8859-1"?> <chart> <series title="Series1" type="Point" color="#FF0000"> <points c ...


 

 首先提供兩個XML文件

XML代碼如下:

1、Example.xml

<?xml version="1.0" encoding="ISO-8859-1"?>
<chart>
<series title="Series1" type="Point" color="#FF0000">
<points count="6">
<point index="0" Y="339"/>
<point index="1" Y="215"/>
<point index="2" Y="122"/>
<point index="3" Y="237"/>
<point index="4" Y="184"/>
<point index="5" Y="101"/>
</points>
</series>

<series title="Series2" type="Point" color="#008000">
<points count="6">
<point index="0" Y="356"/>
<point index="1" Y="340"/>
<point index="2" Y="341"/>
<point index="3" Y="352"/>
<point index="4" Y="352"/>
<point index="5" Y="377"/>
</points>
</series>

<series title="Series3" type="Point" color="#FFFF00">
<points count="6">
<point index="0" Y="347"/>
<point index="1" Y="345"/>
<point index="2" Y="312"/>
<point index="3" Y="293"/>
<point index="4" Y="283"/>
<point index="5" Y="251"/>
</points>
</series>

<series title="Series4" type="Point" color="#0000FF">
<points count="6">
<point index="0" Y="180"/>
<point index="1" Y="191"/>
<point index="2" Y="200"/>
<point index="3" Y="194"/>
<point index="4" Y="164"/>
<point index="5" Y="131"/>
</points>
</series>

</chart>
View Code

2、Example1.xml

<?xml version="1.0" encoding="ISO-8859-1"?>
<chart>
<series title="Series1" type="Point" color="#FF0000">
<points count="6">
<point index="0" Y="100"/>
<point index="1" Y="215"/>
<point index="2" Y="122"/>
<point index="3" Y="237"/>
<point index="4" Y="184"/>
<point index="5" Y="101"/>
</points>
</series>

<series title="Series2" type="Point" color="#008000">
<points count="6">
<point index="6" Y="356"/>
<point index="7" Y="340"/>
<point index="8" Y="341"/>
<point index="9" Y="200"/>
<point index="10" Y="352"/>
<point index="11" Y="377"/>
</points>
</series>

<series title="Series3" type="Point" color="#FFFF00">
<points count="6">
<point index="0" Y="347"/>
<point index="1" Y="345"/>
<point index="2" Y="312"/>
<point index="3" Y="293"/>
<point index="4" Y="283"/>
<point index="5" Y="251"/>
</points>
</series>

<series title="Series4" type="Point" color="#0000FF">
<points count="6">
<point index="0" Y="180"/>
<point index="1" Y="191"/>
<point index="2" Y="200"/>
<point index="3" Y="194"/>
<point index="4" Y="164"/>
<point index="5" Y="131"/>
</points>
</series>

</chart>
View Code

界面代碼:

object Form1: TForm1
  Left = 524
  Top = 351
  Width = 653
  Height = 432
  Caption = 'Form1'
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  OnCreate = FormCreate
  PixelsPerInch = 96
  TextHeight = 13
  object Chart1: TChart
    Left = 0
    Top = 0
    Width = 645
    Height = 353
    Title.Text.Strings = (
      'XML數據源演示(TChart)')
    Chart3DPercent = 45
    Align = alTop
    TabOrder = 0
    PrintMargins = (
      15
      22
      15
      22)
    object Series1: TBarSeries
      ColorEachPoint = True
      Marks.Callout.Brush.Color = clBlack
      Marks.Visible = True
      Gradient.Direction = gdTopBottom
      XValues.Name = 'X'
      XValues.Order = loAscending
      YValues.Name = 'Bar'
      YValues.Order = loNone
    end
    object Series2: TBarSeries
      Active = False
      ColorEachPoint = True
      Marks.Callout.Brush.Color = clBlack
      Marks.Visible = True
      DataSource = TeeXMLSource3
      BarStyle = bsRectGradient
      Gradient.Direction = gdTopBottom
      XValues.Name = 'X'
      XValues.Order = loAscending
      YValues.Name = 'Bar'
      YValues.Order = loNone
    end
  end
  object Button1: TButton
    Left = 104
    Top = 360
    Width = 75
    Height = 25
    Caption = '&O.打開XML'
    TabOrder = 1
    OnClick = Button1Click
  end
  object Button2: TButton
    Left = 464
    Top = 360
    Width = 75
    Height = 25
    Caption = '&E.退出'
    TabOrder = 2
    OnClick = Button2Click
  end
  object TeeXMLSource1: TTeeXMLSource
    Active = True
    Chart = Chart1
    FileName = 
      'C:\Users\Lenovo\Desktop\TestD7\ChartDemo\第二章\7、數據源組件TeeXMLSource' +
      '\Example.xml'
    Series = Series1
    SeriesNode = 'Series1'
    ValueSource = 'Y'
  end
  object TeeXMLSource3: TTeeXMLSource
    Active = True
    FileName = 
      'C:\Users\Lenovo\Desktop\TestD7\ChartDemo\第二章\7、數據源組件TeeXMLSource' +
      '\Example1.xml'
    Series = Series2
    SeriesNode = 'Series2'
    ValueSource = 'Y'
  end
end
View Code

功能代碼:

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, TeEngine, TeeURL, TeeXML, StdCtrls, Series, ExtCtrls, TeeProcs,
  Chart, TeeSeriesTextEd;

type
  TForm1 = class(TForm)
    Chart1: TChart;
    Series1: TBarSeries;
    Series2: TBarSeries;
    Button1: TButton;
    Button2: TButton;
    TeeXMLSource1: TTeeXMLSource;
    TeeXMLSource3: TTeeXMLSource;
    procedure FormCreate(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
  Position := poScreenCenter;
  BorderStyle := bsDialog;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  Close;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  TeeXMLSource1.Chart := Chart1;
  TeeXMLSource1.Series := Series1;
  TeeXMLSource1.ValueSource := 'Y';
  //這裡LoadFromFile好像沒什麼用。
//  TeeXMLSource1.LoadFromFile('Example1.xml');
  TeeXMLSource1.FileName := 'Example1.xml';
  TeeXMLSource1.Active := True;
end;

end.
View Code
您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 在實際的開發過程中,我們需要前端頁面向Java端提交請求,這些請求一般分為get方式和post方式,不管是哪一種方式,一般都會攜帶一些參數。這一節,我們來演示一下如何給Controller傳遞參數。 代碼: @RestController public class HelloController { ...
  • 引入模塊 1. /`a.sum(axis=None)` 根據給定軸 計算數組 相關元素之和, 整數或元組,不指定軸則預設求全部元素之和。 若 的`shape (d0,d1,..,dn) axis=(m1,m2,...mi) shape (d0,d1,...,dn) (dm1,dm2,...dmi) ...
  • 這節課,我們來學習一下SpringBoot的環境配置,在SpringBoot中,所有的配置都寫在application.properties中: 我們啟動項目,預設埠是8080,我們現在給他配置一個8088: server.port=8088 運行啟動類,然後在瀏覽器地址欄訪問上一節中的控制器: ...
  • 在開始之前,我們需要去創建一個SpringBoot項目,大家可以去 http://start.spring.io/ 這個網站生成一個項目。 如圖,這邊可以對SpringBoot項目進行詳細設置: 下麵這個web一定要勾選: SpringBoot版本號選擇1.5.10 全部設置好了以後,就點擊這個按鈕 ...
  • 1.引子 大家好,在接下里的半個多小時,我會給大家詳細的介紹SpringBoot的基本使用,相信學完這門課程以後,你會對SpringBoot有一個清晰的認識,並且能夠運用這門比較新穎的技術開發一些小程式。我也希望,這門課程能夠對大家入門SpringBoot框架起到一個良好的助推作用。 在開始之前,我 ...
  • 最近做項目測試的發現,訪問Url返回的時間與資料庫中的不相同,環境是Spring boot+MyBatis+Mysql(阿裡雲伺服器),經過一番折騰,得到瞭解決 問題描述 我是直接使用IDEA的資料庫控制台,往資料庫中某個表插入了數據,該表存在著一個欄位date,此欄位是插入數據的時候由資料庫自動賦 ...
  • 接下來我們就從後置處理器和BeanFactoryAware的角度來看看AnnotationAwareAspectJAutoProxyCreator的Bean定義類創建完成後都做了什麼。 ...
  • 一、編程語言簡介 機器語言 電腦能直接理解的就是二進位指令,所以機器語言就是直接用二進位編程,這意味著機器語言是直接操作硬體的,因此機器語言屬於低級語言, 此處的低級指的是底層、貼近電腦硬體(貼近代指需要詳細瞭解電腦硬體細節、直接控制硬體) 彙編語言 是一種用於電子電腦、微處理器、微控制器或 ...
一周排行
    -Advertisement-
    Play Games
  • 示例項目結構 在 Visual Studio 中創建一個 WinForms 應用程式後,項目結構如下所示: MyWinFormsApp/ │ ├───Properties/ │ └───Settings.settings │ ├───bin/ │ ├───Debug/ │ └───Release/ ...
  • [STAThread] 特性用於需要與 COM 組件交互的應用程式,尤其是依賴單線程模型(如 Windows Forms 應用程式)的組件。在 STA 模式下,線程擁有自己的消息迴圈,這對於處理用戶界面和某些 COM 組件是必要的。 [STAThread] static void Main(stri ...
  • 在WinForm中使用全局異常捕獲處理 在WinForm應用程式中,全局異常捕獲是確保程式穩定性的關鍵。通過在Program類的Main方法中設置全局異常處理,可以有效地捕獲並處理未預見的異常,從而避免程式崩潰。 註冊全局異常事件 [STAThread] static void Main() { / ...
  • 前言 給大家推薦一款開源的 Winform 控制項庫,可以幫助我們開發更加美觀、漂亮的 WinForm 界面。 項目介紹 SunnyUI.NET 是一個基於 .NET Framework 4.0+、.NET 6、.NET 7 和 .NET 8 的 WinForm 開源控制項庫,同時也提供了工具類庫、擴展 ...
  • 說明 該文章是屬於OverallAuth2.0系列文章,每周更新一篇該系列文章(從0到1完成系統開發)。 該系統文章,我會儘量說的非常詳細,做到不管新手、老手都能看懂。 說明:OverallAuth2.0 是一個簡單、易懂、功能強大的許可權+可視化流程管理系統。 有興趣的朋友,請關註我吧(*^▽^*) ...
  • 一、下載安裝 1.下載git 必須先下載並安裝git,再TortoiseGit下載安裝 git安裝參考教程:https://blog.csdn.net/mukes/article/details/115693833 2.TortoiseGit下載與安裝 TortoiseGit,Git客戶端,32/6 ...
  • 前言 在項目開發過程中,理解數據結構和演算法如同掌握蓋房子的秘訣。演算法不僅能幫助我們編寫高效、優質的代碼,還能解決項目中遇到的各種難題。 給大家推薦一個支持C#的開源免費、新手友好的數據結構與演算法入門教程:Hello演算法。 項目介紹 《Hello Algo》是一本開源免費、新手友好的數據結構與演算法入門 ...
  • 1.生成單個Proto.bat內容 @rem Copyright 2016, Google Inc. @rem All rights reserved. @rem @rem Redistribution and use in source and binary forms, with or with ...
  • 一:背景 1. 講故事 前段時間有位朋友找到我,說他的窗體程式在客戶這邊出現了卡死,讓我幫忙看下怎麼回事?dump也生成了,既然有dump了那就上 windbg 分析吧。 二:WinDbg 分析 1. 為什麼會卡死 窗體程式的卡死,入口門檻很低,後續往下分析就不一定了,不管怎麼說先用 !clrsta ...
  • 前言 人工智慧時代,人臉識別技術已成為安全驗證、身份識別和用戶交互的關鍵工具。 給大家推薦一款.NET 開源提供了強大的人臉識別 API,工具不僅易於集成,還具備高效處理能力。 本文將介紹一款如何利用這些API,為我們的項目添加智能識別的亮點。 項目介紹 GitHub 上擁有 1.2k 星標的 C# ...