0

您好,请您帮我解决以下问题。我创建了一个散点图并从列的数据中绘制了一个图表。使用的数据不只是在确定标签的单元格之后:

Column O:

Pwm1   <-- This is the cell I want to see as the label
27114  <-- not used data for graph
27055  <-- etc
27092
27070  <-- data for graph starts here
27105
27024
27092  <-- data for graph ends here

我希望 LABEL 单元格显示为 Y 列标签名称(现在是 'Column O'),但是如何?据我所知(代码是Delphi,但如果有人可以帮助我提供一个基本示例也可以):

(* Turn the symbol of the data points off *)
oChart.Diagram.SymbolType := _chartChartSymbolTypeNONE;

oDataSeries := oChart.getUsedData;
oDataSequences := oDataSeries.getDataSequences;
ShowMessage(oDataSequences[1].Label.SourceRangeRepresentation);

SourceRangeRepresentation 返回当前标签,但如何更改?

感谢广告

4

1 回答 1

1

这做到了:

(*
creat new DataSequence from range representaion
that provides real data and its role in the series
oDataProvider: com.sun.star.chart2.data.XDataProvider
sRangeRepresentation: range address e.g. Sheet1.A1:B2
sRole: role is defined in com.sun.star.chart2.data.DataSequenceRole
*)
Function CreateDataSequence( oDataProvider : Variant; sRangeRepresentation : String; sRole :String ) : Variant;
Var
        oDataSequence : Variant;

Begin
 (* create .chart2.data.DataSequence from range representation *)
 oDataSequence := oDataProvider.createDataSequenceByRangeRepresentation(sRangeRepresentation);
 If NOT VarIsEmpty(oDataSequence) Then
  oDataSequence.Role := sRole;

 Result := oDataSequence;
End;


oNewLabel := CreateDataSequence(oChart.getDataProvider, '$Sheet1.$O$7', 'label');
oDataSequences[1].setLabel(oNewLabel);
于 2010-11-23T13:38:16.177 回答