Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
widgets
Top-from-dataset-msh
Commits
157333b9
Commit
157333b9
authored
Nov 08, 2021
by
gposysaev
Browse files
Add changes
parent
abea50d5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
78 additions
and
30 deletions
+78
-30
src/indicator-grad.ts
src/indicator-grad.ts
+78
-30
No files found.
src/indicator-grad.ts
View file @
157333b9
...
...
@@ -309,17 +309,46 @@ export class IndicatorGrad extends Widget implements SingleData {
i
=
0
;
}
}
private
unique
(
arr
:
any
[]
=
[])
{
let
result
:
any
[]
=
[];
private
max
(
obj
:
number
[]
=
[])
{
var
a
=
obj
[
0
];
for
(
let
i
=
0
;
i
<
obj
.
length
;
i
++
)
{
a
=
obj
[
i
];
if
(
!
isNaN
(
a
))
break
;
}
for
(
var
i
=
1
;
i
<
obj
.
length
;
i
++
)
{
if
(
obj
[
i
]
>
a
&&
!
isNaN
(
obj
[
i
])
&&
obj
[
i
]
!=
null
&&
obj
[
i
]
!=
Infinity
)
{
a
=
obj
[
i
];
}
}
return
a
;
}
private
min
(
obj
:
number
[]
=
[])
{
var
a
=
obj
[
0
];
for
(
let
i
=
0
;
i
<
obj
.
length
;
i
++
)
{
a
=
obj
[
i
];
if
(
!
isNaN
(
a
))
break
;
}
for
(
let
str
of
arr
)
{
if
(
!
result
.
includes
(
str
))
{
result
.
push
(
str
);
for
(
var
i
=
1
;
i
<
obj
.
length
;
i
++
)
{
if
(
obj
[
i
]
<
a
&&
!
isNaN
(
obj
[
i
])
&&
obj
[
i
]
!=
null
&&
obj
[
i
]
!=
Infinity
)
{
a
=
obj
[
i
];
}
}
return
result
;
return
a
;
}
private
getDiffParams
(
planB
:
number
[]
=
[],
planA
:
number
[]
=
[],
...
...
@@ -328,30 +357,49 @@ export class IndicatorGrad extends Widget implements SingleData {
):
string
{
let
value
:
number
[]
=
[];
for
(
let
i
=
0
;
i
<
planB
.
length
;
i
++
)
{
value
.
push
(
this
.
viewSettings
.
typeValue
==
EValueType
.
ChangeDole
?
(
planA
[
i
]
/
planB
[
i
])
*
100
-
(
planA1
[
i
]
/
planB1
[
i
])
*
100
:
this
.
viewSettings
.
typeValue
==
EValueType
.
CalculatedValue
?
((
planA
[
i
]
/
planB
[
i
]
-
planA1
[
i
]
/
planB1
[
i
])
/
(
planA1
[
i
]
/
planB1
[
i
]))
*
100
:
this
.
viewSettings
.
typeValue
==
EValueType
.
PlanFact
?
(
planA
[
i
]
/
planB
[
i
])
*
100
:
this
.
viewSettings
.
typeValue
==
EValueType
.
Change
?
planA
[
i
]
-
planB
[
i
]
:
this
.
viewSettings
.
typeValue
==
EValueType
.
ChangeInPercents
?
((
planA
[
i
]
-
planB
[
i
])
/
planB
[
i
])
*
100
:
this
.
viewSettings
.
typeValue
==
EValueType
.
DifferenceSegment
?
planA
[
i
]
/
planB
[
i
]
-
planA1
[
i
]
/
planB1
[
i
]
:
planA
[
i
]
/
planB
[
i
],
);
if
(
this
.
dataSettings
.
columnsByBlock
[
EBlockKey
.
IndicatorB1
].
length
>
0
&&
this
.
dataSettings
.
columnsByBlock
[
EBlockKey
.
IndicatorA1
].
length
>
0
)
value
.
push
(
this
.
viewSettings
.
typeValue
==
EValueType
.
ChangeDole
?
(
planA
[
i
]
/
planB
[
i
])
*
100
-
(
planA1
[
i
]
/
planB1
[
i
])
*
100
:
this
.
viewSettings
.
typeValue
==
EValueType
.
CalculatedValue
?
((
planA
[
i
]
/
planB
[
i
]
-
planA1
[
i
]
/
planB1
[
i
])
/
(
planA1
[
i
]
/
planB1
[
i
]))
*
100
:
this
.
viewSettings
.
typeValue
==
EValueType
.
PlanFact
?
(
planA
[
i
]
/
planB
[
i
])
*
100
:
this
.
viewSettings
.
typeValue
==
EValueType
.
Change
?
planA
[
i
]
-
planB
[
i
]
:
this
.
viewSettings
.
typeValue
==
EValueType
.
ChangeInPercents
?
((
planA
[
i
]
-
planB
[
i
])
/
planB
[
i
])
*
100
:
this
.
viewSettings
.
typeValue
==
EValueType
.
DifferenceSegment
?
planA
[
i
]
/
planB
[
i
]
-
planA1
[
i
]
/
planB1
[
i
]
:
planA
[
i
]
/
planB
[
i
],
);
else
value
.
push
(
this
.
viewSettings
.
typeValue
==
EValueType
.
PlanFact
?
(
planA
[
i
]
/
planB
[
i
])
*
100
:
this
.
viewSettings
.
typeValue
==
EValueType
.
Change
?
planA
[
i
]
-
planB
[
i
]
:
this
.
viewSettings
.
typeValue
==
EValueType
.
ChangeInPercents
?
((
planA
[
i
]
-
planB
[
i
])
/
planB
[
i
])
*
100
:
planA
[
i
]
/
planB
[
i
],
);
}
let
minVal
=
Ma
th
.
min
(
...
value
);
let
minVal
=
th
is
.
min
(
value
);
let
minIterator
=
value
.
findIndex
((
i
)
=>
i
==
minVal
);
let
maxVal
=
Ma
th
.
max
(
...
value
);
let
maxVal
=
th
is
.
max
(
value
);
let
maxIterator
=
value
.
findIndex
((
i
)
=>
i
==
maxVal
);
const
val
=
this
.
viewSettings
[
EViewOption
.
MinMax
]
==
EMinMax
.
Max
...
...
@@ -410,7 +458,7 @@ export class IndicatorGrad extends Widget implements SingleData {
}
}
}
this
.
uniqueDimension
=
this
.
unique
(
this
.
dimension
);
if
(
this
.
dataSettings
.
columnsByBlock
[
EBlockKey
.
IndicatorB1
].
length
>
0
&&
...
...
@@ -427,9 +475,9 @@ export class IndicatorGrad extends Widget implements SingleData {
)
return
this
.
getDiffParams
(
this
.
indB
,
this
.
indA
);
else
{
let
minVal
=
Ma
th
.
min
(
...
this
.
indA
);
let
minVal
=
th
is
.
min
(
this
.
indA
);
let
minIterator
=
this
.
indA
.
findIndex
((
i
)
=>
i
==
minVal
);
let
maxVal
=
Ma
th
.
max
(
...
this
.
indA
);
let
maxVal
=
th
is
.
max
(
this
.
indA
);
let
maxIterator
=
this
.
indA
.
findIndex
((
i
)
=>
i
==
maxVal
);
const
val
=
this
.
viewSettings
[
EViewOption
.
MinMax
]
==
EMinMax
.
Max
...
...
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