Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sdkjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
sdkjs
Commits
89a8a67e
Commit
89a8a67e
authored
Sep 22, 2017
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add functions for LINEST formula
parent
19f340bc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
95 additions
and
12 deletions
+95
-12
cell/model/FormulaObjects/statisticalFunctions.js
cell/model/FormulaObjects/statisticalFunctions.js
+95
-12
No files found.
cell/model/FormulaObjects/statisticalFunctions.js
View file @
89a8a67e
...
@@ -1763,24 +1763,40 @@
...
@@ -1763,24 +1763,40 @@
function
prepeareGrowthTrendCalculation
(
t
,
arg
){
function
prepeareGrowthTrendCalculation
(
t
,
arg
){
//если первое значение число
//если первое значение число
var
tempNumber
;
var
tempNumber
;
if
(
cElementType
.
number
===
arg
[
0
].
type
)
{
if
(
cElementType
.
number
===
arg
[
0
].
type
)
{
tempNumber
=
arg
[
0
];
tempNumber
=
arg
[
0
];
arg
[
0
]
=
new
cArray
();
arg
[
0
]
=
new
cArray
();
arg
[
0
].
addElement
(
tempNumber
);
arg
[
0
].
addElement
(
tempNumber
);
}
else
if
(
cElementType
.
cell
===
arg
[
0
].
type
||
cElementType
.
cell3D
===
arg
[
0
].
type
)
{
tempNumber
=
arg
[
0
].
getValue
();
arg
[
0
]
=
new
cArray
();
arg
[
0
].
addElement
(
tempNumber
);
}
}
//если первое значение число
//если первое значение число
if
(
arg
[
1
]
&&
cElementType
.
number
===
arg
[
1
].
type
){
if
(
arg
[
1
])
{
tempNumber
=
arg
[
1
];
if
(
cElementType
.
number
===
arg
[
1
].
type
)
{
arg
[
1
]
=
new
cArray
();
tempNumber
=
arg
[
1
];
arg
[
1
].
addElement
(
tempNumber
);
arg
[
1
]
=
new
cArray
();
arg
[
1
].
addElement
(
tempNumber
);
}
else
if
(
cElementType
.
cell
===
arg
[
1
].
type
||
cElementType
.
cell3D
===
arg
[
1
].
type
)
{
tempNumber
=
arg
[
1
].
getValue
();
arg
[
1
]
=
new
cArray
();
arg
[
1
].
addElement
(
tempNumber
);
}
}
}
//если первое значение число
//если первое значение число
if
(
arg
[
2
]
&&
cElementType
.
number
===
arg
[
2
].
type
){
if
(
arg
[
2
]
&&
cElementType
.
number
===
arg
[
2
].
type
)
{
tempNumber
=
arg
[
2
];
if
(
cElementType
.
number
===
arg
[
2
].
type
)
{
arg
[
2
]
=
new
cArray
();
tempNumber
=
arg
[
2
];
arg
[
2
].
addElement
(
tempNumber
);
arg
[
2
]
=
new
cArray
();
arg
[
2
].
addElement
(
tempNumber
);
}
else
if
(
cElementType
.
cell
===
arg
[
2
].
type
||
cElementType
.
cell3D
===
arg
[
2
].
type
)
{
tempNumber
=
arg
[
2
].
getValue
();
arg
[
2
]
=
new
cArray
();
arg
[
2
].
addElement
(
tempNumber
);
}
}
}
var
oArguments
=
t
.
_prepareArguments
(
arg
,
arguments
[
1
],
true
,
[
cElementType
.
array
,
cElementType
.
array
,
cElementType
.
array
]);
var
oArguments
=
t
.
_prepareArguments
(
arg
,
arguments
[
1
],
true
,
[
cElementType
.
array
,
cElementType
.
array
,
cElementType
.
array
]);
...
@@ -2072,7 +2088,7 @@
...
@@ -2072,7 +2088,7 @@
}
}
function
CalculateRGPRKP
(
pMatY
,
pMatX
,
bConstant
,
bStats
,
_bRKP
)
{
function
CalculateRGPRKP
(
pMatY
,
pMatX
,
bConstant
,
bStats
,
_bRKP
)
{
var
getMatrixParams
=
CheckMatrix
(
_b
Growth
,
pMatX
,
pMatY
);
var
getMatrixParams
=
CheckMatrix
(
_b
RKP
,
pMatX
,
pMatY
);
if
(
!
getMatrixParams
)
{
if
(
!
getMatrixParams
)
{
return
;
return
;
}
}
...
@@ -2119,7 +2135,7 @@
...
@@ -2119,7 +2135,7 @@
if
(
bConstant
)
{
if
(
bConstant
)
{
var
pNewX
=
matrixClone
(
pMatX
);
var
pNewX
=
matrixClone
(
pMatX
);
var
pNewY
=
matrixClone
(
pMatY
);
var
pNewY
=
matrixClone
(
pMatY
);
if
(
!
p
CopyX
||
!
pCopy
Y
)
{
if
(
!
p
NewX
||
!
pNew
Y
)
{
//PushError(FormulaError::MatrixSize);
//PushError(FormulaError::MatrixSize);
return
;
return
;
}
}
...
@@ -2545,6 +2561,21 @@
...
@@ -2545,6 +2561,21 @@
return
pResMat
;
return
pResMat
;
}
}
function
getBoolValue
(
val
,
defaultValue
){
var
res
=
undefined
!==
defaultValue
?
defaultValue
:
null
;
if
(
!
val
){
return
res
;
}
if
(
cElementType
.
number
===
val
.
type
){
res
=
val
.
tocBool
().
value
;
}
else
if
(
cElementType
.
bool
===
val
.
type
){
res
=
val
.
value
;
}
return
res
;
}
function
GAMMADISTFUNCTION
(
fp
,
fAlpha
,
fBeta
){
function
GAMMADISTFUNCTION
(
fp
,
fAlpha
,
fBeta
){
this
.
fp
=
fp
;
this
.
fp
=
fp
;
this
.
fAlpha
=
fAlpha
;
this
.
fAlpha
=
fAlpha
;
...
@@ -7292,11 +7323,63 @@
...
@@ -7292,11 +7323,63 @@
* @extends {AscCommonExcel.cBaseFunction}
* @extends {AscCommonExcel.cBaseFunction}
*/
*/
function
cLINEST
()
{
function
cLINEST
()
{
cBaseFunction
.
call
(
this
,
"
LINEST
"
);
this
.
name
=
"
LINEST
"
;
this
.
value
=
null
;
this
.
argumentsCurrent
=
0
;
}
}
cLINEST
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cLINEST
.
prototype
=
Object
.
create
(
cBaseFunction
.
prototype
);
cLINEST
.
prototype
.
constructor
=
cLINEST
;
cLINEST
.
prototype
.
constructor
=
cLINEST
;
cLINEST
.
prototype
.
argumentsMin
=
1
;
cLINEST
.
prototype
.
argumentsMax
=
4
;
/*cLINEST.prototype.Calculate = function (arg) {
//если первое значение число
var tempNumber;
if (cElementType.number === arg[0].type) {
tempNumber = arg[0];
arg[0] = new cArray();
arg[0].addElement(tempNumber);
} else if (cElementType.cell === arg[0].type || cElementType.cell3D === arg[0].type) {
tempNumber = arg[0].getValue();
arg[0] = new cArray();
arg[0].addElement(tempNumber);
}
//если первое значение число
if (arg[1]) {
if (cElementType.number === arg[1].type) {
tempNumber = arg[1];
arg[1] = new cArray();
arg[1].addElement(tempNumber);
} else if (cElementType.cell === arg[1].type || cElementType.cell3D === arg[1].type) {
tempNumber = arg[1].getValue();
arg[1] = new cArray();
arg[1].addElement(tempNumber);
}
}
var oArguments = this._prepareArguments(arg, arguments[1], true, [cElementType.array, cElementType.array]);
var argClone = oArguments.args;
var argError;
if (argError = this._checkErrorArg(argClone)) {
return argError;
}
var pMatY = argClone[0];
var pMatX = argClone[1];
var bConstant = getBoolValue(argClone[2], true);
var bStats = getBoolValue(argClone[3], true);
var res = CalculateRGPRKP( pMatY, pMatX, bConstant, bStats);
if(res && res[0] && res[0][0]){
return this.value = new cNumber(res[0][0]);
}else{
return this.value = new cError(cErrorType.wrong_value_type);
}
};*/
/**
/**
* @constructor
* @constructor
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment