Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
compendium-v2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
geant-swd
compendium-v2
Merge requests
!135
Refactor remaining pages & improvements
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Refactor remaining pages & improvements
FixPills
into
develop
Overview
0
Commits
21
Pipelines
0
Changes
2
Merged
Bjarke Madsen
requested to merge
FixPills
into
develop
6 months ago
Overview
0
Commits
21
Pipelines
0
Changes
2
Expand
0
0
Merge request reports
Viewing commit
dcdae7eb
Prev
Next
Show latest version
2 files
+
36
−
27
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
dcdae7eb
extract tooltip structure creation for pilltable into shared function
· dcdae7eb
Bjarke Madsen
authored
6 months ago
compendium-frontend/src/helpers/dataconversion.tsx
+
27
−
0
Options
@@ -36,6 +36,33 @@ function getColorMap() {
return
colorMap
}
export
function
addTooltip
<
T
extends
NrenAndYearDatapoint
>
(
dataLookup
:
Map
<
string
,
Map
<
string
,
Map
<
number
,
T
>>>
,
tooltipProperty
:
string
,
allowColumn
?:
string
,
prefix
?:
string
)
{
const
withTooltip
=
new
Map
<
string
,
Map
<
string
,
Map
<
number
,
{
[
key
:
string
]:
string
|
number
}
>>>
();
for
(
const
[
nren
,
nrenMap
]
of
dataLookup
)
{
const
newNrenMap
=
new
Map
<
string
,
Map
<
number
,
{
[
key
:
string
]:
string
|
number
}
>>
();
for
(
const
[
column
,
yearMap
]
of
nrenMap
)
{
const
newYearMap
=
new
Map
<
number
,
{
[
key
:
string
]:
string
|
number
}
>
();
for
(
const
[
year
,
yearData
]
of
yearMap
)
{
if
(
allowColumn
&&
column
!==
allowColumn
)
{
newYearMap
.
set
(
year
,
{});
continue
;
}
const
tooltipValue
=
yearData
[
tooltipProperty
];
if
(
!
tooltipValue
)
{
newYearMap
.
set
(
year
,
{});
continue
;
}
const
tooltip
=
{
tooltip
:
`
${
prefix
?
prefix
:
''
}${
tooltipValue
}
`
};
newYearMap
.
set
(
year
,
tooltip
);
}
newNrenMap
.
set
(
column
,
newYearMap
);
}
withTooltip
.
set
(
nren
,
newNrenMap
);
}
return
withTooltip
;
}
export
function
getLatestData
<
T
extends
NrenAndYearDatapoint
>
(
data
:
T
[])
{
// Get the latest year for each NREN, and return the data for that year
// Mainly used for URL data, which doesn't make sense to compare across years
Loading