TChart-对象查看器与打印预览
2020-02-29 16:00:45来源:博客园 阅读 ()
TChart-对象查看器与打印预览
界面代码:
object Form1: TForm1 Left = 568 Top = 393 Width = 725 Height = 408 Caption = '对象观察器' Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [] OldCreateOrder = False OnActivate = FormActivate OnCreate = FormCreate PixelsPerInch = 96 TextHeight = 13 object Chart1: TChart Left = 0 Top = 0 Width = 505 Height = 330 Border.Width = 2 Border.Visible = True BottomWall.Gradient.EndColor = 6308951 BottomWall.Gradient.MidColor = 13529477 BottomWall.Gradient.StartColor = 2514871 BottomWall.Gradient.Visible = True Gradient.Balance = 74 Gradient.Direction = gdBottomTop Gradient.EndColor = clWhite Gradient.StartColor = clAqua Gradient.Visible = True LeftWall.Gradient.Balance = 74 LeftWall.Gradient.Direction = gdBottomTop LeftWall.Gradient.EndColor = clBlack LeftWall.Gradient.MidColor = 16744576 LeftWall.Gradient.StartColor = clBlack LeftWall.Gradient.Visible = True Legend.CheckBoxesStyle = cbsRadio Title.Font.Color = clBlack Title.Text.Strings = ( '组件测试:水果产量') BottomAxis.Title.Caption = '品名' Chart3DPercent = 30 LeftAxis.Title.Caption = '数量' Align = alLeft BevelOuter = bvNone TabOrder = 0 Anchors = [akLeft, akTop, akRight, akBottom] PrintMargins = ( 15 13 15 13) object Series1: TBarSeries ColorEachPoint = True Marks.Callout.Brush.Color = clBlack Marks.Gradient.Visible = True Marks.Style = smsLabelValue Marks.Visible = True PercentFormat = '##0,## %' BarStyle = bsRectGradient Gradient.Direction = gdTopBottom Gradient.MidColor = 16059031 Gradient.StartColor = 14540754 XValues.Name = 'X' XValues.Order = loAscending YValues.Name = 'Bar' YValues.Order = loNone end end object TeeInspector1: TTeeInspector Left = 505 Top = 0 Width = 212 Height = 330 Align = alClient FixedCols = 1 RowCount = 8 FixedRows = 0 Options = [goFixedVertLine, goVertLine, goHorzLine, goColSizing, goThumbTracking] TabOrder = 1 Items = < item Caption = '3D' Value = True OnChange = TeeInspector1Items0Change end item Caption = '标签' Value = True OnChange = TeeInspector1Items1Change end item Caption = '图例' Value = True OnChange = TeeInspector1Items2Change end item Caption = '横坐标' Style = iiString Value = '品名' OnChange = TeeInspector1Items3Change end item Caption = '纵坐标' Style = iiString Value = '数量' OnChange = TeeInspector1Items4Change end item Caption = '字颜色' Style = iiColor Value = 0 OnChange = TeeInspector1Items5Change end item Caption = '图表标题' Style = iiString Value = '组件测试:水果产量' OnChange = TeeInspector1Items6Change end> Header.Font.Color = clNavy Header.Font.Gradient.Visible = True ColWidths = ( 82 126) RowHeights = ( 19 19 19 19 19 19 19 19) end object Panel1: TPanel Left = 0 Top = 330 Width = 717 Height = 41 Align = alBottom TabOrder = 2 object Label1: TLabel Left = 16 Top = 11 Width = 49 Height = 13 AutoSize = False Caption = '种类:' end object ComboFlat1: TComboFlat Left = 72 Top = 8 Width = 153 BevelKind = bkSoft Color = clWhite ItemIndex = 0 TabOrder = 0 Text = '苹果' OnChange = ComboFlat1Change Items.Strings = ( '苹果' '桔子' '梨' '葡萄' '甘蔗' '西瓜') end object Button1: TButton Left = 344 Top = 8 Width = 75 Height = 25 Caption = '&R.返回' TabOrder = 1 OnClick = Button1Click end object Button2: TButton Left = 264 Top = 8 Width = 75 Height = 25 Caption = '&P.打印' TabOrder = 2 OnClick = Button2Click end end object ChartPreviewer1: TChartPreviewer Chart = Chart1 Title = '打印...' Left = 232 Top = 201 end endView Code
功能代码
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, TeeEdit, StdCtrls, TeCanvas, ExtCtrls, Grids, TeeInspector, TeEngine, Series, TeeProcs, Chart; type TForm1 = class(TForm) Chart1: TChart; Series1: TBarSeries; TeeInspector1: TTeeInspector; Panel1: TPanel; Label1: TLabel; ComboFlat1: TComboFlat; Button1: TButton; Button2: TButton; ChartPreviewer1: TChartPreviewer; procedure Button1Click(Sender: TObject); procedure ComboFlat1Change(Sender: TObject); procedure FormActivate(Sender: TObject); procedure TeeInspector1Items0Change(Sender: TObject); procedure TeeInspector1Items1Change(Sender: TObject); procedure TeeInspector1Items2Change(Sender: TObject); procedure TeeInspector1Items3Change(Sender: TObject); procedure TeeInspector1Items4Change(Sender: TObject); procedure TeeInspector1Items6Change(Sender: TObject); procedure TeeInspector1Items5Change(Sender: TObject); procedure Button2Click(Sender: TObject); procedure FormCreate(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); begin Close; end; procedure TForm1.ComboFlat1Change(Sender: TObject); begin (* 苹果 桔子 梨 葡萄 甘蔗 西瓜 *) with Series1 do begin Clear; case ComboFlat1.ItemIndex of 0: AddXY(1, 300, '苹果'); 1: AddXY(1, 280, '桔子'); 2: AddXY(1, 450, '梨'); 3: AddXY(1, 340, '葡萄'); 4: AddXY(1, 780, '甘蔗'); 5: AddXY(1, 280, '习惯'); 6: AddXY(1, 890, '柿子'); end; end; end; procedure TForm1.FormActivate(Sender: TObject); begin Series1.AddXY(1, 300, '苹果'); end; procedure TForm1.TeeInspector1Items0Change(Sender: TObject); begin Chart1.View3D := TeeInspector1.Items[0].Value; end; procedure TForm1.TeeInspector1Items1Change(Sender: TObject); begin Series1.Marks.Visible := TeeInspector1.Items[1].Value; end; procedure TForm1.TeeInspector1Items2Change(Sender: TObject); begin Chart1.Legend.Visible := TeeInspector1.Items[2].Value; end; procedure TForm1.TeeInspector1Items3Change(Sender: TObject); begin Chart1.BottomAxis.Title.Caption := TeeInspector1.Items[3].Value; end; procedure TForm1.TeeInspector1Items4Change(Sender: TObject); begin Chart1.LeftAxis.Title.Caption := TeeInspector1.Items[4].Value; end; procedure TForm1.TeeInspector1Items5Change(Sender: TObject); begin Chart1.Title.Font.Color := TeeInspector1.Items[5].Value; Chart1.BottomAxis.Title.Font.Color := TeeInspector1.Items[5].Value; Chart1.LeftAxis.Title.Font.Color := TeeInspector1.Items[5].Value; Chart1.Refresh; end; procedure TForm1.TeeInspector1Items6Change(Sender: TObject); begin Chart1.Title.Text.Text := TeeInspector1.Items[6].Value; end; procedure TForm1.Button2Click(Sender: TObject); begin ChartPreviewer1.Execute; end; procedure TForm1.FormCreate(Sender: TObject); begin Self.Position := poScreenCenter; end; end.View Code
原文链接:https://www.cnblogs.com/adsoft/p/12382444.html
如有疑问请与原作者联系
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
上一篇:TChart-图表的滚动与翻译
- TChart-序列类工具功能演示 2020-03-08
- TChart-图表的滚动与翻译 2020-02-26
- TChart-数据编辑(TChartListBox,TeeCommander) 2020-02-21
- TChart-图表编辑器的测试 2020-02-20
- Delphi-面向对象 2019-12-03
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash