delphi 操作excel 生成图表 怎么显示数据标志,如下图
delphi吧
全部回复
仅看楼主
level 1
aryiel 楼主
求助力。代码如下:
var
startx,i,x:integer;
Cell1,Cell2,Range,Range1,chart:Variant;
begin
try
FExcelApplication:=CreateOleObject('Excel.Application');
except
MessageDlg(rsNoSetup,mtInformation,[mbOK],0);
Exit;
end;
FExcelApplication.WorkBooks.Add;
//FExcelApplication.SheetsInNewWorkbook := High(Args) + 1;
FExcelApplication.WorkBooks[1].WorkSheets[1].Name := '记录表';
Sheet1 := FExcelApplication.WorkBooks[1].WorkSheets['记录表'];
FExcelApplication.Visible:=true;
Sheet1.cells.item[1,1]:='Monthly';
Sheet1.cells.item[1,2]:='Jan';
Sheet1.cells.item[1,3]:='Feb';
Sheet1.cells.item[1,4]:='Mar';
Sheet1.cells.item[1,5]:='Apr';
Sheet1.cells.item[1,6]:='May';
Sheet1.cells.item[1,7]:='Jun';
Sheet1.cells.item[1,8]:='Jul';
Sheet1.cells.item[1,9]:='Aug';
Sheet1.cells.item[1,10]:='Sep';
Sheet1.cells.item[1,11]:='Oct';
Sheet1.cells.item[1,12]:='Nov';
Sheet1.cells.item[1,13]:='Dec';
Sheet1.cells.item[1,13]:='Dec';
startx:=2;
for x:=1 to 4 DO
begin
for i:=1 to 12 DO
begin
Sheet1.cells.item[x+1,1]:=x;
Sheet1.cells.item[startx,1+i]:=(i+x)*20;
end;
startx:=startx+1;
end;
range := Sheet1.Range['A1:M1'+','+'A3:M4'];
chart := sheet1.chartobjects.add(0,100,700, 200);
chart.chart.ChartType := 51;
chart.chart.setsourcedata(range);
chart.Chart.HasTitle:=True;
chart.Chart.ChartTitle.Characters.Text:='Excle二维图';
chart.chart.SeriesCollection(2).AxisGroup := 2 ;
chart.chart.SeriesCollection(2).ChartType := 4;
end; 以上原码只是生成图表,没显示数据标志。
求助力怎么显示数据标志
2013年11月28日 08点11分 1
level 1
aryiel 楼主
无人来看下??自己顶起!
2013年11月29日 09点11分 2
level 12
http://iofai.com/501.html里面有chart对象成员表
这些应该在搜索VBA相关的,DELPHI只是外部调用者而已
2014年05月04日 07点05分 3
1