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.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;
proc_c_Chart_Jh14.First;
while not proc_c_Chart_Jh14.Eof do
begin //
S.Add(proc_c_Chart_Jh14.FieldByName('mrjh').AsFloat,Copy(proc_c_Chart_Jh14.FieldByName('mmdd').AsString,5,4), clYellow);
proc_c_Chart_Jh14.Next;
end;
Chart.Legend.Visible := False; //数据框隐藏
Chart.View3D := False;
Chart.BackColor := $0032060C;//clBlue;
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;
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 + '3.bmp';
Chart.SaveToBitmapFile(TmpFile);
Image3.Picture.LoadFromFile(TmpFile);
finally
Chart.Free;
end;
//全年产量
proc_c_Chart_JhCl_Zb.close;
proc_c_Chart_JhCl_Zb.prepared:=true;
proc_c_Chart_JhCl_Zb.open;
proc_c_Chart_JhCl_Zb.First;
Chart := TChart.Create(nil);
try
Chart.Parent := Application.MainForm;
Chart.Height:=220;
Chart.Width:=578;
Chart.Visible := False;
S := TPieSeries.Create(Chart);
Chart.AddSeries(S);
S.Marks.Visible:=False;
//S.Title := '嘿嘿';
S.Add( proc_c_Chart_JhCl_Zb.FieldByName('qncl_hz').AsFloat, '产量', clAqua ); //+FormatFloat('0.00',proc_c_Chart_JhCl_Zb.FieldByName('qncl_hz').AsFloat)
S.Add( proc_c_Chart_JhCl_Zb.FieldByName('qncl').AsFloat, '产量目标', $00804000 ); //+FormatFloat('0.00',proc_c_Chart_JhCl_Zb.FieldByName('qncl').AsFloat)
if (proc_c_Chart_JhCl_Zb.FieldByName('qncl_hz').AsFloat >0) and
(proc_c_Chart_JhCl_Zb.FieldByName('qncl').AsFloat >0) then
Label21.Caption := '产量占比:'+FormatFloat('0.00',100*proc_c_Chart_JhCl_Zb.FieldByName('qncl_hz').AsFloat/proc_c_Chart_JhCl_Zb.FieldByName('qncl').AsFloat)+'%'
else
Label21.Caption :='';
//Chart.Legend.Visible := False;
Chart.View3D := False;
Chart.BackColor := $0032060C;//clBlue;
Chart.Gradient.StartColor := $0032060C;
Chart.Gradient.EndColor := $0032060C;
Chart.Gradient.Visible := True;
Chart.Walls.Back.Transparent:=True;
Chart.BevelOuter:=bvNone;
TmpFile := Application.ExeName + '5.bmp';
Chart.SaveToBitmapFile(TmpFile);
Image5.Picture.LoadFromFile(TmpFile);
finally
Chart.Free;
end;
//全年进货
Chart := TChart.Create(nil);
try
Chart.Parent := Application.MainForm;
Chart.Height:=220;
Chart.Width:=578;
Chart.Visible := False;
S := TPieSeries.Create(Chart);
Chart.AddSeries(S);
S.Marks.Visible:=False;
//S.Title := '嘿嘿';
S.Add( proc_c_Chart_JhCl_Zb.FieldByName('qnjh_hz').AsFloat, '进货', clAqua );//+FormatFloat('0.00',proc_c_Chart_JhCl_Zb.FieldByName('qnjh_hz').AsFloat)
S.Add( proc_c_Chart_JhCl_Zb.FieldByName('qnjh').AsFloat, '进货目标', $00804000 );//+FormatFloat('0.00',proc_c_Chart_JhCl_Zb.FieldByName('qnjh').AsFloat)
if (proc_c_Chart_JhCl_Zb.FieldByName('qnjh_hz').AsFloat >0) and
(proc_c_Chart_JhCl_Zb.FieldByName('qnjh').AsFloat >0) then
Label22.Caption := '进货占比:'+FormatFloat('0.00',100*proc_c_Chart_JhCl_Zb.FieldByName('qnjh_hz').AsFloat/proc_c_Chart_JhCl_Zb.FieldByName('qnjh').AsFloat)+'%'
else
Label22.Caption :='';
//Chart.Legend.Visible := False;
Chart.View3D := False;
Chart.BackColor := $0032060C;//clBlue;
Chart.Gradient.StartColor := $0032060C;
Chart.Gradient.EndColor := $0032060C;
Chart.Gradient.Visible := True;
Chart.Walls.Back.Transparent:=True;
Chart.BevelOuter:=bvNone;
TmpFile := Application.ExeName + '8.bmp';
Chart.SaveToBitmapFile(TmpFile);
Image8.Picture.LoadFromFile(TmpFile);
finally
Chart.Free;
end;
//每月产量
proc_c_Chart_Cl_Month.close;
proc_c_Chart_Cl_Month.prepared:=true;
proc_c_Chart_Cl_Month.open;
Chart := TChart.Create(nil);
try
Chart.Parent := Application.MainForm;
Chart.Height:=246;
Chart.Width:=593;
Chart.Visible := False;
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;
proc_c_Chart_Cl_Month.First;
while not proc_c_Chart_Cl_Month.Eof do
begin
S.Add(proc_c_Chart_Cl_Month.FieldByName('mycl').AsFloat,Copy(proc_c_Chart_Cl_Month.FieldByName('ny').AsString,6,2), clMoneyGreen);//clMoneyGreen
proc_c_Chart_Cl_Month.Next;
end;
Chart.Legend.Visible := False;
Chart.View3D := False;
Chart.BackColor := $0032060C;//clBlue;
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;
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;
TmpFile := Application.ExeName + '6.bmp';
Chart.SaveToBitmapFile(TmpFile);
Image6.Picture.LoadFromFile(TmpFile);
finally
Chart.Free;
end;
//当月入炉平均热值,含硫,含氟曲线
proc_c_Chart_Month_HotSF.close;
proc_c_Chart_Month_HotSF.prepared:=true;
proc_c_Chart_Month_HotSF.open;
Chart := TChart.Create(nil);
try
Chart.Parent := Application.MainForm;
Chart.Height:=180;
Chart.Width:=593;
Chart.Visible := False;
L := TLineSeries.Create(Chart);
Chart.AddSeries(L);
TLineSeries(Chart.Series[0]).LinePen.Width:=3;
//TBarSeries(Chart.Series[0]).BarStyle:=bsRectGradient;
//将数据显示在上面
//L.Marks.Style:=smsValue;
proc_c_Chart_Month_HotSF.DisableControls;
proc_c_Chart_Month_HotSF.First;
while not proc_c_Chart_Month_HotSF.Eof do
begin
L.Add(proc_c_Chart_Month_HotSF.FieldByName('lz').AsFloat,Copy(proc_c_Chart_Month_HotSF.FieldByName('yymmdd').AsString,9,2), clRed); //Copy(proc_c_Chart_Cl14.FieldByName('rq').AsString,6,5)
proc_c_Chart_Month_HotSF.Next;
end;
proc_c_Chart_Month_HotSF.EnableControls;
Chart.Legend.Visible := False; //数据框隐藏
Chart.View3D := False;
Chart.BackColor := $0032060C;//clBlue; //$00DB6817 //$0031080D
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;
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;
TmpFile := Application.ExeName + '7.bmp';
Chart.SaveToBitmapFile(TmpFile);
Image7.Picture.LoadFromFile(TmpFile);
finally
Chart.Free;
end;
//含硫含f
Chart := TChart.Create(nil);
try
Chart.Parent := Application.MainForm;
Chart.Height:=180;
Chart.Width:=593;
Chart.Visible := False;
S := TLineSeries.Create(Chart);
F := TLineSeries.Create(Chart);
Chart.AddSeries(S);
Chart.AddSeries(F);
TLineSeries(Chart.Series[0]).LinePen.Width:=3;
TLineSeries(Chart.Series[1]).LinePen.Width:=3;
proc_c_Chart_Month_HotSF.DisableControls;
proc_c_Chart_Month_HotSF.First;
while not proc_c_Chart_Month_HotSF.Eof do
begin
S.Add(proc_c_Chart_Month_HotSF.FieldByName('hs').AsFloat,Copy(proc_c_Chart_Month_HotSF.FieldByName('yymmdd').AsString,9,2), clLime); //Copy(proc_c_Chart_Cl14.FieldByName('rq').AsString,6,5)
F.Add(proc_c_Chart_Month_HotSF.FieldByName('hf').AsFloat,Copy(proc_c_Chart_Month_HotSF.FieldByName('yymmdd').AsString,9,2), clYellow); //Copy(proc_c_Chart_Cl14.FieldByName('rq').AsString,6,5)
proc_c_Chart_Month_HotSF.Next;
end;
proc_c_Chart_Month_HotSF.EnableControls;
Chart.Legend.Visible := False; //数据框隐藏
Chart.View3D := False;
Chart.BackColor := $0032060C;//clBlue; //$00DB6817 //$0031080D
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;
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;
TmpFile := Application.ExeName + '10.bmp';
Chart.SaveToBitmapFile(TmpFile);
Image10.Picture.LoadFromFile(TmpFile);
finally
Chart.Free;
end;
proc_c_Chart_Today.close;
proc_c_Chart_Today.prepared:=true;
proc_c_Chart_Today.open;
proc_c_Chart_Today.First;
Chart := TChart.Create(nil);
try
Chart.Parent := Application.MainForm;
Chart.Height:=220;
Chart.Width:=578;
Chart.Visible := False;
S := TPieSeries.Create(Chart);
Chart.AddSeries(S);
S.Marks.Visible:=False;
S.Add( proc_c_Chart_Today.FieldByName('jrjc_sl').AsFloat, '已完成', clAqua );
S.Add( proc_c_Chart_Today.FieldByName('jrjc_slwwc').AsFloat, '未完成', $00804000 );
if (proc_c_Chart_Today.FieldByName('jrjc_sl').AsFloat+proc_c_Chart_Today.FieldByName('jrjc_slwwc').AsFloat >0) then
Label23.Caption := '完成占比:'+FormatFloat('0.00',100*proc_c_Chart_Today.FieldByName('jrjc_sl').AsFloat/(proc_c_Chart_Today.FieldByName('jrjc_sl').AsFloat+proc_c_Chart_Today.FieldByName('jrjc_slwwc').AsFloat))+'%'
else
Label23.Caption :='';
//Chart.Legend.Visible := False;
Chart.View3D := False;
Chart.BackColor := $0032060C;//$00EFA896 $00DEB469 00612507 0061220D 00A53A16
Chart.Gradient.StartColor := $0032060C;
Chart.Gradient.EndColor := $0032060C;
Chart.Gradient.Visible := True;
Chart.Walls.Back.Transparent:=True;
Chart.BevelOuter:=bvNone;
TmpFile := Application.ExeName + '9.bmp';
Chart.SaveToBitmapFile(TmpFile);
Image9.Picture.LoadFromFile(TmpFile);
finally
Chart.Free;
end;
Label19.Caption:= proc_c_Chart_Today.FieldByName('jrqy_sl').AsString;//今日取样量
Label20.Caption:= proc_c_Chart_Today.FieldByName('jrjc_sl').AsString;//'今日检测数量'+
Label11.Caption:= proc_c_Chart_Today.FieldByName('jrjh_jh').AsString;
Label12.Caption:= proc_c_Chart_Today.FieldByName('jrjh_sj').AsString;
Label13.Caption:= proc_c_Chart_Today.FieldByName('jrtl_jh').AsString;
Label14.Caption:= proc_c_Chart_Today.FieldByName('jrtl_sj').AsString;
Edit2.Text:= proc_c_Chart_Today.FieldByName('eq_lx').AsString;
Edit3.Text:= proc_c_Chart_Today.FieldByName('eq_total').AsString;
Edit4.Text:= proc_c_Chart_Today.FieldByName('sq_lx').AsString;
Edit5.Text:= proc_c_Chart_Today.FieldByName('sq_total').AsString;
Edit6.SetFocus;
end;