Excel2000.pas has bugs, Chart.location is not work (50分)

  • 主题发起人 主题发起人 yyanghhong
  • 开始时间 开始时间
Y

yyanghhong

Unregistered / Unconfirmed
GUEST, unregistred user!
Here is the code. who encounter same problem before.

procedure TCubeChart.Show;
var
oResizeRange, oChart, oSeries: Variant;
iRet : Integer;
left, top, colcount, rowcount : integer;
begin
try
// Add a chart for the selected data
oChart := HostSheet.Parent.Charts.Add;
oResizeRange := HostSheet.Range[getColFromNum(Left+1)+inttostr(Top+1)+':'+
getColFromNum(Left+ColCount)+inttostr(Top+RowCount)];
oChart.ChartWizard(oResizeRange,xlLine,xlColumns);

oChart.ChartType := xlLineMarkers ;
oChart.Axes(xlValue).TickLabels.NumberFormat := getFormatStr(ValueFormat);
oChart.Axes(xlCategory).TickLabels.NumberFormat := getFormatStr(CategoryFormat);

oChart.PlotArea.Border.LineStyle := xlNone ;
oChart.PlotArea.Interior.ColorIndex := xlNone ;

oChart.HasTitle := True ;
oChart.ChartTitle.Text := DataSource.Caption;
oChart.Legend.Position:= xlBottom ;
oChart.Legend.Border.LineStyle := xlNone ;

oResizeRange := HostSheet.Range[getColFromNum(Left)+inttostr(Top+1)+':'+
getColFromNum(Left)+inttostr(Top+RowCount)];


for iRet := 0 to DataSource.ColCount-1 do
begin
oChart.SeriesCollection.Item[iRet+1].XValues := oResizeRange;
oChart.SeriesCollection.Item[iRet+1].Name := DataSource.Cols[iRet];
end;

oChart.Location(xlLocationAsObject,HostSheet.Name); // wrong here
oSeries := null;
oChart := null;
except
// RaiseExcelException;
end;
 
后退
顶部