Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Register
Sign in
Toggle navigation
Menu
UPSMF
uphrh-smf-analytics
Commits
93db6e46
Commit
93db6e46
authored
3 years ago
by
Darshan M N
Browse files
Options
Download
Patches
Plain Diff
Making the Visualization a cumulative one
parent
616ab5c4
master
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/com/tarento/analytics/handler/LineChartResponseHandler.java
+15
-10
...m/tarento/analytics/handler/LineChartResponseHandler.java
src/main/resources/schema/SMF_ChartApiConfig.json
+1
-1
src/main/resources/schema/SMF_ChartApiConfig.json
with
16 additions
and
11 deletions
+16
-11
src/main/java/com/tarento/analytics/handler/LineChartResponseHandler.java
+
15
−
10
View file @
93db6e46
...
...
@@ -88,6 +88,7 @@ public class LineChartResponseHandler implements IResponseHandler {
double
previousVal
=
!
isCumulative
?
0.0
:
(
totalValues
.
size
()
>
0
?
totalValues
.
get
(
totalValues
.
size
()
-
1
)
:
0.0
);
double
value
;
if
(
action
.
equals
(
"Negative Count"
)
&&
action
!=
null
&&
bucket
.
findValue
(
IResponseHandler
.
NEGATIVE_COUNT
)
!=
null
)
{
...
...
@@ -95,7 +96,7 @@ public class LineChartResponseHandler implements IResponseHandler {
?
bucket
.
findValue
(
IResponseHandler
.
VALUE
).
asDouble
()
*
-
1
:
bucket
.
findValue
(
IResponseHandler
.
DOC_COUNT
).
asDouble
());
}
else
{
if
(
bucket
.
findValue
(
IResponseHandler
.
CUMULATIVE_VALUE
)
!=
null
)
{
if
(
isCumulative
)
{
value
=
previousVal
+
((
bucket
.
findValue
(
IResponseHandler
.
VALUE
)
!=
null
)
?
bucket
.
findValue
(
IResponseHandler
.
VALUE
).
asDouble
()
:
bucket
.
findValue
(
IResponseHandler
.
DOC_COUNT
).
asDouble
());
...
...
@@ -115,17 +116,21 @@ public class LineChartResponseHandler implements IResponseHandler {
.
map
(
e
->
new
Plot
(
e
.
getKey
(),
e
.
getValue
(),
symbol
,
headerLabel
,
valueLabel
))
.
collect
(
Collectors
.
toList
());
try
{
Data
data
=
new
Data
(
headerPath
.
asText
(),
(
totalValues
==
null
||
totalValues
.
isEmpty
())
?
0.0
:
totalValues
.
stream
().
reduce
(
0.0
,
Double:
:
sum
),
symbol
);
/*
* Data data; if(!isCumulative) { data = new Data(headerPath.asText(),
* (totalValues==null || totalValues.isEmpty()) ? 0.0 :
* totalValues.stream().reduce(0.0, Double::sum), symbol); } else { data = new
* Data(headerPath.asText(), (totalValues==null || totalValues.isEmpty()) ? 0.0
* : plots.get(plots.size()-1), symbol); }
*/
// Data data = new Data(headerPath.asText(), (totalValues == null || totalValues.isEmpty()) ? 0.0
// : totalValues.stream().reduce(0.0, Double::sum), symbol);
Data
data
;
if
(!
isCumulative
)
{
data
=
new
Data
(
headerPath
.
asText
(),
(
totalValues
==
null
||
totalValues
.
isEmpty
())
?
0.0
:
totalValues
.
stream
().
reduce
(
0.0
,
Double:
:
sum
),
symbol
);
}
else
{
data
=
new
Data
(
headerPath
.
asText
(),
(
totalValues
==
null
||
totalValues
.
isEmpty
())
?
0.0
:
plots
.
get
(
plots
.
size
()
-
1
),
symbol
);
}
data
.
setPlots
(
plots
);
dataList
.
add
(
data
);
}
catch
(
Exception
e
)
{
logger
.
error
(
" Legend/Header "
+
headerPath
.
asText
()
+
" exception occurred "
+
e
.
getMessage
());
}
...
...
This diff is collapsed.
Click to expand it.
src/main/resources/schema/SMF_ChartApiConfig.json
+
1
−
1
View file @
93db6e46
...
...
@@ -157,7 +157,7 @@
}
],
"chartType"
:
"line"
,
"resultType"
:
"
doc_count
"
,
"resultType"
:
"
value
"
,
"valueType"
:
"number"
,
"isDecimal"
:
true
,
"action"
:
""
,
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets