procedure TFrmScsjkb.FormShow(Sender: TObject);
var
Chart: TChart; //test
L,S,F: TChartSeries;//test
seriesCl,seriesJh: TBarSeries;//TLineSeries;
seriesQncl,SeriesQnjh,seriesJcZb: TPieSeries;
seriesMycl,seriesLz,seriesS,seriesF:TLineSeries;
na:Integer;
TmpFile: string;
begin
Image3.Parent.DoubleBuffered:=true;
Image4.Parent.DoubleBuffered:=true;
Image5.Parent.DoubleBuffered:=true;
Image6.Parent.DoubleBuffered:=true;
Image7.Parent.DoubleBuffered:=true;
Image8.Parent.DoubleBuffered:=true;
Image9.Parent.DoubleBuffered:=true;
Image10.Parent.DoubleBuffered:=true;
Label24.Caption :=FormatDateTime('yyyy-mm-dd hh:mm',Now());
proc_c_Chart_Cl14.close;
proc_c_Chart_Cl14.prepared:=true;
proc_c_Chart_Cl14.open;
Chart := TChart.Create(nil);
try
Chart.Parent := Application.MainForm;
Chart.Height:=407;
Chart.Width:=597;
Chart.Visible := False;
//Chart.Title.Text.Text := '测试图表';
S := TBarSeries.Create(Chart);
Chart.AddSeries(S);
TBarSeries(Chart.Series[0]).BarWidthPercent:=35;
TBarSeries(Chart.Series[0]).BarStyle:=bsRectGradient;
//将数据显示在上面
S.Marks.Style:=smsValue;
//不显示数据边框,强制显示数值
S.Marks.Transparent:=True;
S.Marks.AutoPosition:=True;
S.Marks.FontSeriesColor:=True;
S.Marks.Angle:=45;
//S.BarStyle:= bsRectGradient;
//S.Format.BarStyle:=bsRectGradient;
//S.Title := '嘿嘿';
proc_c_Chart_Cl14.First;
while not proc_c_Chart_Cl14.Eof do
begin
S.Add(proc_c_Chart_Cl14.FieldByName('mrcl').AsFloat,Copy(proc_c_Chart_Cl14.FieldByName('mmdd').AsString,5,4),clMoneyGreen );//clMoneyGreen
proc_c_Chart_Cl14.Next;
end;
Chart.Legend.Visible := False; //数据框隐藏
Chart.View3D := False;
Chart.BackColor := $0032060C;//clBlue; $00DB6817 $0032060C
Chart.Gradient.StartColor := $0032060C;
Chart.Gradient.EndColor := $0032060C;
Chart.Gradient.Visible := True;
Chart.Walls.Back.Transparent:=True;
Chart.BevelOuter:=bvNone;
Chart.LeftAxis.LabelsFormat.Font.Color:=clAqua; //$0000FF80
Chart.BottomAxis.LabelsFormat.Font.Color:=clAqua;
Chart.LeftAxis.Grid.Visible:=False;
Chart.BottomAxis.Grid.Visible:=False;
Chart.Walls.Visible:=False;
Chart.LeftAxis.Axis.Color:=clBlue;
Chart.BottomAxis.Axis.Color:=clBlue;
//Chart.BottomAxis.LabelsAngle:=270;
Chart.BottomAxis.LabelsAlternate:=True;
TmpFile := Application.ExeName + '4.bmp';
Chart.SaveToBitmapFile(TmpFile);
Image4.Picture.LoadFromFile(TmpFile);
finally
Chart.Free;
end;
proc_c_Chart_Jh14.close;
proc_c_Chart_Jh14.prepared:=true;
proc_c_Chart_Jh14.open;
Chart := TChart.Create(nil);
try
Chart.Parent := Application.MainForm;
Chart.Hei

本文介绍了如何使用TChart组件创建实时图表,包括产量、进货对比、月度产量变化和热值分析,通过实例展示了如何从数据库读取数据并动态更新图表,以可视化关键业务指标。
最低0.47元/天 解锁文章
9772

被折叠的 条评论
为什么被折叠?



