delphi生成excle三维饼图,帮帮忙,我可以生成三维的饼图,但我得到的是一个属性对应的整个图。我想要多个属性把此图根据他们所占的比重,分配。帮帮忙,挣了一下午了

解决方案 »

  1.   

    不会,帮你顶一下.(没试过用EXCEL做三维图.呵呵,如果你会用VB脚本编出的话,应该能转成DELPHI的)不然,你得查到三维图的相关函数(EXCEL)
      

  2.   

    这个是我写的一部分代码,希望有帮助 achart1 := Excelid.worksheets[ImagePage].chartobjects.add(leftPostion,topPostion,widthPostion,heightPostion);      achart1.chart.charttype := xl3DPieExploded;//xl3DPie ;  //生成何种类型的图
          //设置x轴、y轴数据
          cell1 :=  Excelid.worksheets[dataPage].Cells[ExRowsName,1];
          cell2 :=  Excelid.worksheets[dataPage].Cells[ExRowsName,ExClos-1];
          cell3 :=  Excelid.worksheets[dataPage].Cells[ExRowsValue,1];
          cell4 :=  Excelid.worksheets[dataPage].Cells[ExRowsValue,ExClos-1];      Range1 := Excelid.worksheets[dataPage].Range[cell1, cell2]; //设定Chart类别坐标轴(x轴)的取值区域      Range2 := Excelid.worksheets[dataPage].Range[cell3, cell4]; //设定Chart数值坐标轴(y轴)的取值区域      series1:= achart1.chart.seriescollection ;
          //series1.add (Range2,xlColumns,false);  //设置y轴的数据
          series1.add (Range2,true);          //可以使用,能够生成饼图
          //achart1.chart.seriescollection[1].name:='nihao';
          //设置饼图的形式
          achart1.chart.seriescollection[1].ApplyDataLabels(xlDataLabelsShowLabelAndPercent,true,true,true);
          achart1.Chart.Axes[xlCategory].CategoryNames := Range1;  //设置x轴数据      //series1.add (Range2,xlColumns,false);  //设置y轴的数据
          //achart1.Chart.Axes[xlCategory].CategoryNames := Range1;  //设置x轴数据
          //删除右侧的标题
          achart1.Chart.Legend.delete;      //添加图表标题
          achart1.Chart.HasTitle:=True;
          achart1.Chart.ChartTitle.Characters.Text:=CheckListBoxPOTT.Items[i];
          achart1.Chart.HasLegend:=true;
          achart1.Chart.Legend.Position := xlBottom;