Skip to content
Next
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Minds Frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
872
Issues
872
List
Boards
Labels
Service Desk
Milestones
Merge Requests
47
Merge Requests
47
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Security & Compliance
Security & Compliance
Dependency List
Packages
Packages
List
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Minds
Minds Frontend
Commits
5760aeab
Commit
5760aeab
authored
2 days ago
by
Mark Harding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(wip): various fixes for infinite loops
parent
b56f3b5e
feat/entity-centric-metrics
1 merge request
!579
WIP: Entity centric metrics (analytics v2)
Pipeline
#86613839
failed with stages
in 5 minutes and 32 seconds
Changes
6
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
78 additions
and
449 deletions
+78
-449
src/app/modules/analytics/v2/components/chart/chart.component.ts
.../modules/analytics/v2/components/chart/chart.component.ts
+1
-63
src/app/modules/analytics/v2/components/metrics/metrics.component.html
...es/analytics/v2/components/metrics/metrics.component.html
+3
-3
src/app/modules/analytics/v2/components/metrics/metrics.component.ts
...ules/analytics/v2/components/metrics/metrics.component.ts
+25
-17
src/app/modules/analytics/v2/dashboard.component.html
src/app/modules/analytics/v2/dashboard.component.html
+5
-5
src/app/modules/analytics/v2/dashboard.component.ts
src/app/modules/analytics/v2/dashboard.component.ts
+1
-0
src/app/modules/analytics/v2/dashboard.service.ts
src/app/modules/analytics/v2/dashboard.service.ts
+43
-361
No files found.
src/app/modules/analytics/v2/components/chart/chart.component.ts
View file @
5760aeab
...
...
@@ -399,7 +399,7 @@ export class AnalyticsChartComponent implements OnInit, OnDestroy {
const
dataUpdate
=
this
.
setData
();
const
layoutUpdate
=
this
.
setLayout
();
Plotly
.
update
(
'
graphDiv
'
,
dataUpdate
,
layoutUpdate
);
//
Plotly.update('graphDiv', dataUpdate, layoutUpdate);
}
// GRAPH /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
...
...
@@ -407,11 +407,6 @@ export class AnalyticsChartComponent implements OnInit, OnDestroy {
// // -------------------------------------------
// // DRAW THE GRAPH ----------------------------
// -------------------------------------------
Plotly
.
plot
(
'
graphDiv
'
,
this
.
data
,
this
.
layout
,
{
displayModeBar
:
false
,
responsive
:
true
,
// Doesn't do anything
});
this
.
setVertLineHeights
();
}
setVertLineHeights
()
{
...
...
@@ -435,61 +430,6 @@ export class AnalyticsChartComponent implements OnInit, OnDestroy {
this
.
hoverVertLines
.
shapes
[
this
.
thisPoint
].
line
.
color
=
this
.
getColor
(
'
m-grey-50
'
);
Plotly
.
relayout
(
'
graphDiv
'
,
this
.
hoverVertLines
);
// SHOW MARKER
Plotly
.
restyle
(
'
graphDiv
'
,
{
marker
:
{
opacity
:
this
.
hoverMarkerOpacities
,
size
:
this
.
defaultMarkerSize
,
},
});
// SHOW TOOLTIP
const
xaxis
=
$event
.
points
[
0
].
xaxis
,
yaxis
=
$event
.
points
[
0
].
yaxis
,
tooltipDistX
=
xaxis
.
d2p
(
$event
.
points
[
0
].
x
),
tooltipDistY
=
yaxis
.
d2p
(
$event
.
points
[
0
].
y
);
this
.
hoverInfoDiv
.
style
.
opacity
=
1
;
// console.log(xaxis._offset);
// console.log(yaxis._offset);
if
(
this
.
thisPoint
<
this
.
segmentLength
/
2
)
{
this
.
hoverInfoDiv
.
style
.
top
=
tooltipDistX
+
xaxis
.
_offset
+
20
+
'
px
'
;
this
.
hoverInfoDiv
.
style
.
left
=
tooltipDistY
+
yaxis
.
_offset
+
20
+
'
px
'
;
}
else
{
// TODO move the second half of tooltips to the left of points
// TODO also shift down/up if with x% of rangeMin/rangeMax???
this
.
hoverInfoDiv
.
style
.
top
=
tooltipDistX
+
xaxis
.
_offset
+
20
+
'
px
'
;
this
.
hoverInfoDiv
.
style
.
left
=
tooltipDistY
+
yaxis
.
_offset
+
20
+
'
px
'
;
}
// // Plotly.restyle(this.graphDiv, this.hoverStyles, 0);
// this.hoverInfoTextX = $event.points.map(function(d) {
// return '' + d.x;
// });
// this.hoverInfoTextY = $event.points.map(function(d) {
// return d.y.toPrecision(3) + ' borks';
// });
// this.hoverInfoComparisonTextXy = $event.points.map(function(d) {
// // TODO: how best to connect current with comparison segment data
// return 'vs 700 Tues Oct 1st';
// });
// const xaxis = $event.points[0].xaxis,
// yaxis = $event.points[0].yaxis;
// $event.points.forEach(function(p) {
// this.closestHoverPointPositionX = xaxis.d2p(p.x);
// this.closestHoverPointPositionY = yaxis.d2p(p.x);
// });
// this.hoverInfoXDiv.textContent = this.hoverInfoXText.join();
// this.hoverInfoYDiv.textContent = this.hoverInfoYText.join();
// this.hoverInfoComparisonXyDiv.textContent = this.hoverInfoComparisonXyText.join();
}
// $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
...
...
@@ -500,12 +440,10 @@ export class AnalyticsChartComponent implements OnInit, OnDestroy {
this
.
hoverVertLines
.
shapes
[
this
.
thisPoint
].
line
.
color
=
this
.
getColor
(
'
m-grey-50-transparent
'
);
Plotly
.
relayout
(
'
graphDiv
'
,
this
.
hoverVertLines
);
// HIDE MARKER
this
.
hoverInfoDiv
.
style
.
opacity
=
0
;
this
.
hoverMarkerOpacities
[
this
.
thisPoint
]
=
this
.
defaultMarkerOpacity
;
Plotly
.
restyle
(
'
graphDiv
'
,
'
marker.opacity
'
,
this
.
hoverMarkerOpacities
);
}
// // TODO: reimplement bc plotly responsive config doesn't work
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/analytics/v2/components/metrics/metrics.component.html
View file @
5760aeab
<div
class=
"metricsContainer"
*ngIf=
"
vm$ | async as vm
"
>
<div
class=
"metricsContainer"
*ngIf=
"
metrics$ | async as metrics
"
>
<div
class=
"metric"
*ngFor=
"let metric of
vm.
metrics"
*ngFor=
"let metric of metrics"
(click)=
"updateMetric(metric)"
[ngClass]=
"{ active: metric.
id === vm.metric.id
}"
[ngClass]=
"{ active: metric.
visualisation
}"
>
<div
class=
"metricLabel"
>
{{ metric.label }}
</div>
<!-- TODO the "| number" pipe should be from backend so it can dynamically handle diff decimals/currency formats -->
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/analytics/v2/components/metrics/metrics.component.ts
View file @
5760aeab
...
...
@@ -5,6 +5,8 @@ import {
OnDestroy
,
}
from
'
@angular/core
'
;
import
{
Observable
,
Subscription
}
from
'
rxjs
'
;
import
{
map
}
from
'
rxjs/operators
'
;
import
{
AnalyticsDashboardService
,
Category
,
...
...
@@ -38,29 +40,35 @@ export class AnalyticsMetricsComponent implements OnInit, OnDestroy {
//TODO: (maybe) interface ViewMetric implements Metric {}
vm$
:
Observable
<
UserState
>
=
this
.
analyticsService
.
vm$
;
vm
:
UserState
;
metrics$
;
constructor
(
private
analyticsService
:
AnalyticsDashboardService
)
{}
ngOnInit
()
{
this
.
subscription
=
this
.
vm$
.
subscribe
(
viewModel
=>
(
this
.
vm
=
viewModel
));
this
.
vm
.
metrics
.
forEach
(
metric
=>
{
const
delta
=
(
metric
.
summary
.
current_value
-
metric
.
summary
.
comparison_value
)
/
metric
.
summary
.
comparison_value
;
this
.
metrics$
=
this
.
vm$
.
pipe
(
map
(
vm
=>
{
const
metrics
=
vm
.
metrics
.
map
(
metric
=>
({...
metric
}));
// Clone to avoid updating
for
(
let
metric
of
metrics
)
{
const
delta
=
(
metric
.
summary
.
current_value
-
metric
.
summary
.
comparison_value
)
/
metric
.
summary
.
comparison_value
;
metric
[
'
delta
'
]
=
delta
;
metric
[
'
hasChanged
'
]
=
delta
===
0
?
false
:
true
;
metric
[
'
delta
'
]
=
delta
;
metric
[
'
hasChanged
'
]
=
delta
===
0
?
false
:
true
;
if
(
(
delta
>
0
&&
metric
.
summary
.
comparison_positive_inclination
)
||
(
delta
<
0
&&
!
metric
.
summary
.
comparison_positive_inclination
)
)
{
metric
[
'
positiveTrend
'
]
=
true
;
}
else
{
metric
[
'
positiveTrend
'
]
=
false
;
if
(
(
delta
>
0
&&
metric
.
summary
.
comparison_positive_inclination
)
||
(
delta
<
0
&&
!
metric
.
summary
.
comparison_positive_inclination
)
)
{
metric
[
'
positiveTrend
'
]
=
true
;
metric
[
'
positiveTrendy
'
]
=
true
;
}
else
{
metric
[
'
positiveTrend
'
]
=
false
;
}
}
});
return
metrics
;
}));
}
updateMetric
(
metric
)
{
...
...
@@ -68,6 +76,6 @@ export class AnalyticsMetricsComponent implements OnInit, OnDestroy {
}
ngOnDestroy
()
{
this
.
subscription
.
unsubscribe
();
//
this.subscription.unsubscribe();
}
}
This diff is collapsed.
Click to expand it.
src/app/modules/analytics/v2/dashboard.component.html
View file @
5760aeab
...
...
@@ -6,15 +6,15 @@
<i
class=
"material-icons"
>
menu
</i>
<div
class=
"cat"
*ngFor=
"let cat of cats"
>
<span
[ngClass]=
"{ selected: cat.id === vm.category }"
>
{{
cat.label
cat
?
.label
}}
</span>
</div>
</div>
</section>
<section
class=
"main"
>
<section
class=
"main"
*ngIf=
"(ready$ | async)"
>
<div
class=
"mainHeader"
>
<h3
class=
"selectedCatLabel"
>
{{ selectedCat.label }}
{{ selectedCat
?
.label }}
</h3>
<div
class=
"globalFilters"
>
<div
class=
"channelSearch"
>
...
...
@@ -35,11 +35,11 @@
></m-analytics
__layout--chart
>
<!-- <m-analytics__layout--table
class="m-analytics__layout"
*ngIf="selectedCat.type === 'table'"
*ngIf="selectedCat
?
.type === 'table'"
></m-analytics__layout--table>
<m-analytics__layout--summary
class="m-analytics__layout"
*ngIf="selectedCat.type === 'summary'"
*ngIf="selectedCat
?
.type === 'summary'"
></m-analytics__layout--summary> -->
</section>
</div>
This diff is collapsed.
Click to expand it.
src/app/modules/analytics/v2/dashboard.component.ts
View file @
5760aeab
...
...
@@ -53,6 +53,7 @@ export class AnalyticsDashboardComponent implements OnInit, OnDestroy {
options
:
[],
};
vm$
:
Observable
<
UserState
>
=
this
.
analyticsService
.
vm$
;
ready$
:
Observable
<
boolean
>
=
this
.
analyticsService
.
ready$
;
vm
:
UserState
;
constructor
(
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/analytics/v2/dashboard.service.ts
View file @
5760aeab
This diff is collapsed.
Click to expand it.
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