OpenOffice Calc 自动化如何更改散点图的图表标签

发布于 2024-10-02 16:14:38 字数 741 浏览 0 评论 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 返回当前标签,但如何更改?

感谢广告

Hello could you please help me with the following. I have created a scattered chart and draw a chart from data of a column. The used data is not just after the cell which determines the label:

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

I would like the LABEL cell to appear as the Y column label name (Is now 'Column O'), but how?
This as far as I got (code is Delphi but if someone could help me with a basic example that's ok too):

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

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

SourceRangeRepresentation returns the current label, but how to change?

Thanks Ad

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

余生再见 2024-10-09 16:14:39

这做到了:

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

This did it:

(*
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);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文