开发环境 Delphi XE2
最近做一个项目 需要显示每个部门的收发件数,
数据集如下
类型 | 总件数 | 已结算件数 | 未结算件数 |
客户 | 5000 | 3000 | 2000 |
业务员 | 3000 | 2000 | 1000 |
unit Unit2;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, VCLTee.TeEngine,
VCLTee.Series, Vcl.ExtCtrls, VCLTee.TeeProcs, VCLTee.Chart, VCLTee.DBChart;
type
TForm2 = class(TForm)
DBChart1: TDBChart;
Series2: TBarSeries;
Series3: TBarSeries;
Series1: TBarSeries;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure TForm2.FormCreate(Sender: TObject);
begin
Series1.ManualData:=True;
Series2.ManualData:=True;
Series3.ManualData:=True;
Series1.Add(3000,'业务员'); //总件数
Series1.Add(5000,'客户');
Series2.Add(2000,'业务员'); //已结算件数
Series2.Add(3000,'客户');
Series3.Add(1000,'业务员');//未结算件数
Series3.Add(2000,'客户');
end;
end.
dfm单元
object Form2: TForm2
Left = 0
Top = 0
Caption = 'Form2'
ClientHeight = 466
ClientWidth = 647
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
object DBChart1: TDBChart
Left = 0
Top = 0
Width = 647
Height = 466
AllowPanning = pmNone
Title.AdjustFrame = False
Title.Shadow.Visible = False
Title.Text.Strings = (
'TDBChart')
DepthAxis.Title.Transparent = False
LeftAxis.Title.Caption = #21333#20301#65306#20803
LeftAxis.Title.ShapeStyle = fosRoundRectangle
Legend.Alignment = laBottom
Legend.Font.Shadow.Visible = False
Legend.Title.Font.Shadow.Visible = False
Legend.Title.Shadow.Visible = False
RightAxis.LabelsExponent = True
View3D = False
Align = alClient
TabOrder = 0
PrintMargins = (
15
18
15
18)
ColorPaletteIndex = 13
object Series1: TBarSeries
Marks.Arrow.Visible = False
Marks.Callout.Brush.Color = clBlack
Marks.Callout.Arrow.Visible = False
Marks.Emboss.Color = 8553090
Marks.Font.Emboss.Visible = True
Marks.Font.Gradient.Outline = True
Marks.Shadow.Color = 8684676
Marks.Style = smsValue
Marks.Symbol.Visible = True
Marks.Visible = True
Title = #24635#20214#25968
Emboss.Color = 8816262
Shadow.Color = 8816262
Shadow.Visible = False
XValues.Name = 'X'
XValues.Order = loAscending
YValues.Name = 'Bar'
YValues.Order = loNone
Data = {0000000000}
end
object Series2: TBarSeries
Marks.Arrow.Visible = True
Marks.Callout.Brush.Color = clBlack
Marks.Callout.Arrow.Visible = True
Marks.Style = smsValue
Marks.Visible = True
Title = #24050#32467#31639#20214#25968
Emboss.Color = 8947848
Shadow.Color = 8947848
XValues.Name = 'X'
XValues.Order = loAscending
YValues.Name = 'Bar'
YValues.Order = loNone
Data = {0000000000}
end
object Series3: TBarSeries
Marks.Arrow.Visible = True
Marks.Callout.Brush.Color = clBlack
Marks.Callout.Arrow.Visible = True
Marks.Style = smsValue
Marks.Visible = True
Title = #26410#32467#31639#20214#25968
Emboss.Color = 8947848
Shadow.Color = 8947848
XValues.Name = 'X'
XValues.Order = loAscending
YValues.Name = 'Bar'
YValues.Order = loNone
Data = {0000000000}
end
end
end
效果图如下
如果需要代码 请去资源里面下载