⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmdataresult.pas

📁 用于建筑的测斜数据处理!把测试设备的数据下载电脑,通过本系统进行分析,然后生成所需要的数据!
💻 PAS
📖 第 1 页 / 共 2 页
字号:
if (rdpfx.ItemIndex=1) and (rdpnr.ItemIndex=0) then
begin
        chart.LeftAxis.Title.Caption:='平面差';
        for i:=1 to datenum do
        begin
                for j:=1 to depthnum do
                begin
                        stringgrid1.Cells[i+1,j]:=formatfloat('0.0',datapmcb[i,j]);
                        stringgrid1.Cells[1,j]:=formatfloat('0.0',datadepth[i,j]);
                        if (j=1) and (i=1) then
                        begin
                                max:=datapmcb[i,j];
                                min:=datapmcb[i,j];
                        end
                        else
                        begin
                                max:=getmax(max,datapmcb[i,j]);
                                min:=getmin(min,datapmcb[i,j]);
                        end;
                end;
        end;
end;

if (rdpfx.ItemIndex=1) and (rdpnr.ItemIndex=1) then
begin
        chart.LeftAxis.Title.Caption:='平均差';
        for i:=1 to datenum do
        begin
                for j:=1 to depthnum do
                begin
                        stringgrid1.Cells[i+1,j]:=formatfloat('0.0',datapjcb[i,j]);
                        stringgrid1.Cells[1,j]:=formatfloat('0.0',datadepth[i,j]);
                        if (j=1) and (i=1) then
                        begin
                                max:=datapjcb[i,j];
                                min:=datapjcb[i,j];
                        end
                        else
                        begin
                                max:=getmax(max,datapjcb[i,j]);
                                min:=getmin(min,datapjcb[i,j]);
                        end;
                end;
        end;
end;
if (rdpfx.ItemIndex=1) and (rdpnr.ItemIndex=2) then
begin
        chart.LeftAxis.Title.Caption:='累积差';
        for i:=1 to datenum do
        begin
                for j:=1 to depthnum do
                begin
                        stringgrid1.Cells[i+1,j]:=formatfloat('0.0',dataljcb[i,j]);
                        stringgrid1.Cells[1,j]:=formatfloat('0.0',datadepth[i,j]);
                        if (j=1) and (i=1) then
                        begin
                                max:=dataljcb[i,j];
                                min:=dataljcb[i,j];
                        end
                        else
                        begin
                                max:=getmax(max,dataljcb[i,j]);
                                min:=getmin(min,dataljcb[i,j]);
                        end;
                end;
        end;
end;
if (rdpfx.ItemIndex=1) and (rdpnr.ItemIndex=3) then
begin
        chart.LeftAxis.Title.Caption:='比较差';
        for i:=1 to datenum do
        begin
                for j:=1 to depthnum do
                begin
                        stringgrid1.Cells[i+1,j]:=formatfloat('0.0',datazzb[i,j]);
                        stringgrid1.Cells[1,j]:=formatfloat('0.0',datadepth[i,j]);
                        if (j=1) and (i=1) then
                        begin
                                max:=datazzb[i,j];
                                min:=datazzb[i,j];
                        end
                        else
                        begin
                                max:=getmax(max,datazzb[i,j]);
                                min:=getmin(min,datazzb[i,j]);
                        end;
                end;
        end;
end;
chart.LeftAxis.Maximum:=max;
if min>max then
        chart.LeftAxis.Minimum:=max
else
        chart.LeftAxis.Minimum:=min;

for i:=1 to datenum do  //自动添加series
        TLineSeries(findcomponent('series'+inttostr(i))).Clear;
//如果只有两个值进行比较的时候,不能完全显示图形
for j:=1 to datenum do
begin
        TLineSeries(findcomponent('series'+inttostr(j))).Title:=datestr[j];
        for i:=1 to depthnum do
        begin
                TLineSeries(findcomponent('series'+inttostr(j))).Add(strtofloat(stringgrid1.Cells[j,i]),stringgrid1.Cells[1,i]);
                if  strtofloat(stringgrid1.Cells[j,i])<>0 then
                        flag:=false;
        end;
        if flag then
                TLineSeries(findcomponent('series'+inttostr(j))).LineHeight:=100;
end;

end;

procedure Tdataresult.FormClose(Sender: TObject; var Action: TCloseAction);
var i:integer;
begin
for i:=1 to datenum do
        TLineSeries(findcomponent('series'+inttostr(i))).Destroy;
if openflag2 then
        Fvexcel.quit;
end;

procedure Tdataresult.Button3Click(Sender: TObject);
var
        i,j:integer;
        gao:real;
        dir:string;
        Cell1,Cell2,Cell3,Cell4,Range1,Range2,range3:Variant;
begin
//到Excel中可以改数值,并自动变化图形 --
dir:=extractfiledir(application.ExeName);
openexceldir(dir+'\mb.xlt');
openflag2:=true;
for i:=0 to main.Memo_head.Lines.Count-1 do
        FvExcel.cells[i+1,1]:=main.Memo_head.Lines[i];
Sheet1:=FvExcel.Workbooks[1].Worksheets['sheet1'];
for i:=1 to datenum+1 do
begin
        if i=1 then
                FvExcel.cells[16,i]:='深度'
        else
        begin
                FvExcel.cells[16,i]:=datestr[i-1];
                Range3:= FvExcel.activesheet.Range[sheet1.cells[16,i],sheet1.cells[16,i]];
                range3.Borders.LineStyle:=xlContinuous;
        end;
        for j:=1 to depthnum do
        begin
                FvExcel.cells[16+j,i]:=stringgrid1.Cells[i,j];
                Range3:= FvExcel.activesheet.Range[sheet1.cells[16+j,i],sheet1.cells[16+j,i]];
                range3.Borders.LineStyle:=xlContinuous;
        end;
end;
        {chart.Height:=400;
        chart.Width:=1000;
        chart.CopyToClipboardBitmap;
        chart.Height:=233;
        chart.Width:=812;
        FvExcel.Activesheet.range['A50'].PasteSpecial;//图像可以活动
        //FvExcel.Workbooks.Add();   }
        gao:=FvExcel.ActiveSheet.Rows[2].RowHeight;
        FvExcel.Activesheet.range['C10'].Interior.ColorIndex:=4;
        FvExcel.Activesheet.range['C10'].Interior.Pattern:=xlSolid;
        FvExcel.Activesheet.range['C11'].Interior.ColorIndex:=8;
        FvExcel.Activesheet.range['C11'].Interior.Pattern:=xlSolid;
        {---------------------------------------------------------------------
        向工作表中添加內嵌圖表﹐
        Add方法中的四個參數分別表示與儲存格A1的
        左邊距﹑頂部邊距﹑以及圖表的寬度 and 高度﹔
        ----------------------------------------------------------------------}
        Sheet1.ChartObjects.add(60,gao*(depthnum+16),500, 280);
        sheet1.ChartObjects[1].Activate; //激活當前圖表
        sheet1.ChartObjects[1].Chart.charttype:=xlXYScatterSmoothNoMarkers;  //charttype
        //temploop深度,
        //temploop2日期
        for i:=1 to datenum do
        begin
                cell1:=sheet1.cells.item[17,1];
                cell2:=sheet1.cells.item[16+depthnum,1];
                cell3:=sheet1.cells.item[17,i+1];
                cell4:=sheet1.cells.item[16+depthnum,i+1];
                range1:=sheet1.range[cell1,cell2];   ////设置Chart类别座标轴的取值范围
                range2:=sheet1.range[cell3,cell4];
                sheet1.ChartObjects[1].Chart.seriescollection.ADD[Range2];
                sheet1.ChartObjects[1].Chart.seriescollection[i].xvalues:=Range2;  //Y轴数值
                sheet1.ChartObjects[1].Chart.seriescollection[i].values:=Range1;   //X轴数值
                sheet1.ChartObjects[1].Chart.Axes[xlCategory].HasTitle:=True;
                sheet1.ChartObjects[1].Chart.Axes[xlValue].HasTitle:=True;
                sheet1.ChartObjects[1].Chart.Axes[xlCategory].MinimumScale:=min;//設定數值座標軸的最小刻度值﹔
                sheet1.ChartObjects[1].Chart.Axes[xlCategory].MaximumScale:=max;//設定數值座標軸的最大刻度值﹔
                //sheet1.ChartObjects[1].Chart.Axes[xlCategory].MajorUnit:=10; //設定數值座標的主要單位﹔
                //sheet1.ChartObjects[1].Chart.Axes[xlCategory].MinorUnit:=10; //設定數值座標的次要單位﹔
                sheet1.ChartObjects[1].Chart.HasLegend:=true;//顯示圖例
                sheet1.ChartObjects[1].Chart.SeriesCollection(i).Name:=datestr[i]; //设置图例--这里为日期;
                sheet1.ChartObjects[1].Chart.Axes[xlValue].AxisTitle.Text:='深度';  //类别坐标轴标签
                sheet1.ChartObjects[1].Chart.Axes[xlCategory].AxisTitle.Text:=rdpnr.Items[rdpnr.ItemIndex]; //类别坐标轴标签
                sheet1.ChartObjects[1].Chart.ChartGroups(1).VaryByCategories:=true;//對每個資料標號指定不同的色彩或圖樣.}
        end;

end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -