回帰曲線 
曲線に対応したサービスをインスタンス化して追加します。
名前 | サービス名 |
直線 | com.sun.star.comp.chart2.LinearRegressionCurve |
指数 | com.sun.star.comp.chart2.ExponentialRegressionCurve |
対数 | com.sun.star.comp.chart2.LogarithmicRegressionCurve |
平均 | com.sun.star.comp.chart2.MeanValueRegressionCurve |
| com.sun.star.comp.chart2.PotentialRegressionCurve |
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
| | Function AddRegressionCurveExample
oSheets = ThisComponent.getSheets()
oObj1 = oSheets.getByIndex(0)
oCharts = oObj1.getCharts()
oObj2 = oCharts.getByIndex(0)
oEmbeddedObject = oObj2.getEmbeddedObject()
oFirstDiagram = oEmbeddedObject.getFirstDiagram()
oCoordinateSystems = oFirstDiagram.getCoordinateSystems()
oXCoordinateSystem = oCoordinateSystems(0)
oChartTypes = oXCoordinateSystem.getChartTypes()
oXChartType = oChartTypes(0)
sChartType = oXChartType.getChartType()
oDataSeries = oXChartType.getDataSeries()
oXDataSeries = oDataSeries(0)
aXSeries = nothing
aYSeries = nothing
oDataSequences = oXDataSeries.getDataSequences()
for i = 0 to ubound(oDataSequences) step 1
oXLabeledDataSequence = oDataSequences(i)
oValues = oXLabeledDataSequence.getValues()
sRole = oValues.Role
if sRole = "values-x" then
aXSeries = oValues.getData()
elseif sRole = "values-y" then
aYSeries = oValues.getData()
end if
next
oCurve = CreateUnoService("com.sun.star.comp.chart2.LinearRegressionCurve")
oCalculator = oCurve.getCalculator()
oCalculator.recalculateRegression(aXSeries, aYSeries)
oXDataSeries.addRegressionCurve(oCurve)
End Function
|