2010-11-16 43 views
0

您好,请您帮我解决以下问题。我创建了一个分散的图表,并从一列的数据绘制图表。使用的数据不只是这决定了标签的单元格后:OpenOffice Calc自动化如何更改散点图的图表标签

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列标签名(现已“列O”),但如何? 这个据我得到了(代码是德尔福,但如果有人可以帮助我,也没什么太一个基本的例子):

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

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

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

由于广告

回答

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);