最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Delphi 生成excel中餅圖的實例代碼

 更新時間:2013年08月19日 16:09:35   作者:  
這篇文章介紹了Delphi 生成excel中餅圖的實例代碼,有需要的朋友可以參考一下
復(fù)制代碼 代碼如下:

var
  i,j,m,n,count1:integer;
  str:string;
  Jdate:tdatetime;
  channellist,potBstrtime,potEstrtime,Jchannelname:string;
  Rres:boolean;
  JSHR:double;
  Excelid,achart1,cell1,cell2,cell3,cell4,cellMiddle,Range1,Range2,series1:variant;
  ExRowsValue,ExRowsName,ExClos:Integer;
  ImagePage,dataPage:integer;
  leftPostion,topPostion,widthPostion,heightPostion:integer;
begin
  //創(chuàng)建OLE對象
  try
    Excelid:=CreateOleObject( 'Excel.Application' );
  except
    on Exception do raise exception.Create('無法創(chuàng)建Xls文件,請確認(rèn)是否安裝EXCEL')
  end;
  Excelid.Visible := false; //Excel顯示設(shè)置
  Excelid.WorkBooks.Add;  //生成新的excel文件
  //不用excel以前的頁
  Excelid.worksheets.add;
  dataPage:=Excelid.Worksheets.count;   //用作數(shù)據(jù)頁
  Excelid.worksheets.add;
  ImagePage:=Excelid.Worksheets.count;
  //showmessage(inttostr(dataPage));
  //showmessage(inttostr(ImagePage)+'sdfg');
  Jdate:=DateTimePicker1.Date;
  count1:=0;
  ExRowsValue:=1; //存儲值
  ExRowsName:=2;  //存儲名稱
  //取得頻率編號
  for i:=0 to CheckListBoxFQ.Items.Count-1 do
  begin
    if CheckListBoxFQ.Checked[i] then
    begin
     channellist:= QCaky.FChannelList[i]+','+channellist;
    end;
  end;
  delete(channellist,length(channellist),1);
  leftPostion:=20;
  topPostion:=50;
  widthPostion:=450;
  heightPostion:=230;
  for i:=0 to CheckListBoxPOTT.Items.Count-1 do
  begin
    if CheckListBoxPOTT.Checked[i] then
    begin
      //動態(tài)生成excel頁數(shù)
      //Excelid.worksheets.add;
      //sheetCount:=sheetCount+1;
      //Excelid.worksheets[sheetCount].name:='圖表頁'+inttostr(sheetCount);
      //在這里生成圖表
      if CheckListBoxPOTT.Items[i]='全天' then
      begin
        potBstrtime:='';
        potEstrtime:='';
      end
      else
      begin
        potBstrtime:=QCaky.FPOTbeginList[i];
        potEstrtime:=QCaky.FPOTendList[i];
      end;
      Rres:=QCaky.getFQShr(Jdate,FormMain.QAreacode,channellist,potBstrtime,potEstrtime);  //取得占有率
      ExClos:=1;
      while not QCaky.FADOQueryFQ.Eof do
      begin
        Excelid.worksheets[dataPage].Activate;
        Jchannelname:=QCaky.FADOQueryFQ.fieldbyname('channelname').AsString;
        JSHR:=QCaky.FADOQueryFQ.fieldbyname('allshr').AsFloat;
        Excelid.worksheets[dataPage].Cells[ExRowsName,ExClos].Value :=Jchannelname;
        Excelid.worksheets[dataPage].Cells[ExRowsValue,ExClos].Value :=JSHR;
        inc(ExClos);
        QCaky.FADOQueryFQ.Next;
      end;
       {添加一個二維圖(20,50,450,230)表示(左,頂,寬,高)}
      //achart1 := Excelid.worksheets[ImagePage].chartobjects.add(20,50,450,230);
      achart1 := Excelid.worksheets[ImagePage].chartobjects.add(leftPostion,topPostion,widthPostion,heightPostion);
      achart1.chart.charttype := xl3DPie ;  //生成何種類型的圖********在此生成的是餅圖
      //設(shè)置x軸、y軸數(shù)據(jù)
      cell1 :=  Excelid.worksheets[dataPage].Cells[ExRowsName,1];
      cell2 :=  Excelid.worksheets[dataPage].Cells[ExRowsName,ExClos];
      cell3 :=  Excelid.worksheets[dataPage].Cells[ExRowsValue,1];
      cell4 :=  Excelid.worksheets[dataPage].Cells[ExRowsValue,ExClos];
      Range1 := Excelid.worksheets[dataPage].Range[cell1, cell2]; //設(shè)定Chart類別坐標(biāo)軸(x軸)的取值區(qū)域
      Range2 := Excelid.worksheets[dataPage].Range[cell3, cell4]; //設(shè)定Chart數(shù)值坐標(biāo)軸(y軸)的取值區(qū)域
      series1:= achart1.chart.seriescollection ;
      //series1.add (Range2,xlColumns,false);  //設(shè)置y軸的數(shù)據(jù)
      series1.add (Range2,true);          //可以使用,能夠生成餅圖
      achart1.chart.seriescollection[1].name:='nihao';
      //設(shè)置餅圖的形式
      achart1.chart.seriescollection[1].ApplyDataLabels(xlDataLabelsShowLabelAndPercent,true,true,true);
      achart1.Chart.Axes[xlCategory].CategoryNames := Range1;  //設(shè)置x軸數(shù)據(jù)
      //series1.add (Range2,xlColumns,false);  //設(shè)置y軸的數(shù)據(jù)
      //achart1.Chart.Axes[xlCategory].CategoryNames := Range1;  //設(shè)置x軸數(shù)據(jù)
      //刪除右側(cè)的標(biāo)題
      achart1.Chart.Legend.delete;
      //添加圖表標(biāo)題
      achart1.Chart.HasTitle:=True;
      achart1.Chart.ChartTitle.Characters.Text:='收視率走勢圖';
      achart1.Chart.HasLegend:=true;
      achart1.Chart.Legend.Position := xlBottom;
      //圖表左標(biāo)說明
      //achart1.Chart.Axes(xlValue,xlPrimary).HasTitle := True;
      //achart1.Chart.Axes(xlValue,xlPrimary).AxisTitle.Characters.Text := '收視率(%)';
      //圖表下標(biāo)說明
      //achart1.Chart.Axes(xlCategory,xlPrimary).HasTitle:=True;
      //achart1.Chart.Axes(xlCategory,xlPrimary).AxisTitle.Characters.Text:='時間';
      ExRowsName:=ExRowsName+2;
      ExRowsValue:=ExRowsValue+2;
    end;  //如果時段設(shè)置被選中
    leftPostion:=20;
    topPostion:=topPostion+600;
    //showmessage(inttostr(dataPage));
  end;
  Excelid.Visible := true;
end;

相關(guān)文章

  • Delphi遠(yuǎn)程連接Mysql的實現(xiàn)方法

    Delphi遠(yuǎn)程連接Mysql的實現(xiàn)方法

    這篇文章主要介紹了Delphi遠(yuǎn)程連接Mysql的實現(xiàn)方法,需要的朋友可以參考下
    2014-09-09
  • delphi程序全屏顯示無標(biāo)題欄覆蓋整個屏幕(適合屏保)

    delphi程序全屏顯示無標(biāo)題欄覆蓋整個屏幕(適合屏保)

    delphi 簡單實現(xiàn)程序全屏顯示無標(biāo)題欄,覆蓋整個屏幕,這個在做工控機或屏保時有用的,具體代碼如下,感興趣的朋友可以參考下哈
    2013-06-06
  • 初探Delphi中的插件編程

    初探Delphi中的插件編程

    前言我寫Delphi程序是從MIS系統(tǒng)入門的,開始嘗試子系統(tǒng)劃分的時候采用的是MDI窗體的結(jié)構(gòu)。隨著系統(tǒng)功能的擴充,不斷有新的子系統(tǒng)加入系統(tǒng)中,單個工程會變得非常大,每次做一點修改都要重新編譯,單個工程的形式也不利于團隊協(xié)作。為了提高工作效率,我希望利用DLL動態(tài)鏈接庫的形式實現(xiàn)插件結(jié)構(gòu)的編程。
    2008-03-03
  • delphi實現(xiàn)將BMP格式圖形轉(zhuǎn)化為JPG格式圖形的方法

    delphi實現(xiàn)將BMP格式圖形轉(zhuǎn)化為JPG格式圖形的方法

    這篇文章主要介紹了delphi實現(xiàn)將BMP格式圖形轉(zhuǎn)化為JPG格式圖形的方法,通過簡單的自定義函數(shù)調(diào)用系統(tǒng)自帶的changefileext及SaveToFile等方法來實現(xiàn)格式轉(zhuǎn)換功能,是非常實用的技巧,需要的朋友可以參考下
    2014-12-12
  • 截取指定符號之間的字符串(隨機讀取)delphi實例代碼

    截取指定符號之間的字符串(隨機讀取)delphi實例代碼

    這篇文章主要介紹了截取指定符號之間的字符串(隨機讀取)delphi實例代碼,有需要的朋友可以參考一下
    2013-12-12
  • springboot如何完美通過token獲取用戶信息

    springboot如何完美通過token獲取用戶信息

    這篇文章主要給大家介紹了關(guān)于springboot如何完美通過token獲取用戶信息的相關(guān)資料, Token是在服務(wù)端產(chǎn)生的,如果前端使用用戶名/密碼向服務(wù)端請求認(rèn)證,服務(wù)端認(rèn)證成功,那么在服務(wù)端會返回Token給前端,需要的朋友可以參考下
    2023-12-12
  • Java中CountDownLatch和CyclicBarrier的區(qū)別與詳解

    Java中CountDownLatch和CyclicBarrier的區(qū)別與詳解

    CountDownLatch和CyclicBarrier是Java并發(fā)包提供的兩個非常易用的線程同步工具類,本文主要介紹了Java中CountDownLatch和CyclicBarrier的區(qū)別與詳解,具有一定的參考價值,感興趣的可以了解一下
    2023-11-11
  • Delphi中設(shè)置條件斷點的方法講解

    Delphi中設(shè)置條件斷點的方法講解

    這篇文章主要介紹了Delphi中設(shè)置條件斷點的方法,有需要的朋友可以參考一下
    2014-01-01
  • Delphi基本圖像處理方法匯總

    Delphi基本圖像處理方法匯總

    這篇文章主要介紹了Delphi基本圖像處理方法,實例匯總了Delphi操作圖像實現(xiàn)浮雕、反色、模糊、翻轉(zhuǎn)等常用效果的方法,非常具有實用價值,需要的朋友可以參考下
    2015-05-05
  • Delphi 中內(nèi)存映射對于大文件的使用

    Delphi 中內(nèi)存映射對于大文件的使用

    這篇文章主要介紹了Delphi 中內(nèi)存映射對于大文件的使用的相關(guān)資料,希望通過本文能幫助到大家,需要的朋友可以參考下
    2017-09-09

最新評論

内江市| 阳东县| 安徽省| 琼海市| 乌苏市| 汝南县| 茌平县| 湖南省| 丹棱县| 雅江县| 合阳县| 简阳市| 林周县| 玉溪市| 西畴县| 安陆市| 冕宁县| 上虞市| 承德市| 清水县| 固镇县| 五家渠市| 马龙县| 祁阳县| 莱芜市| 衡东县| 安图县| 屏东市| 南岸区| 汽车| 麟游县| 洪泽县| 元谋县| 宝丰县| 兰州市| 宝山区| 内江市| 文山县| 榆中县| 襄汾县| 陆河县|