Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
Nos Hs2023
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Språksamlingane
stadnamn
Nos Hs2023
Commits
4a596b32
Commit
4a596b32
authored
6 years ago
by
esikkala
Browse files
Options
Downloads
Patches
Plain Diff
Add creation place distribution
parent
19c00641
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/client/components/Pie.js
+26
-16
26 additions, 16 deletions
src/client/components/Pie.js
src/client/containers/MapApp.js
+2
-1
2 additions, 1 deletion
src/client/containers/MapApp.js
src/client/reducers/search.js
+1
-1
1 addition, 1 deletion
src/client/reducers/search.js
with
29 additions
and
18 deletions
src/client/components/Pie.js
+
26
−
16
View file @
4a596b32
...
@@ -44,13 +44,12 @@ const styles = theme => ({
...
@@ -44,13 +44,12 @@ const styles = theme => ({
const
combineSmallGroups
=
(
dataArray
)
=>
{
const
combineSmallGroups
=
(
dataArray
)
=>
{
const
totalLength
=
dataArray
.
length
;
const
totalLength
=
dataArray
.
length
;
const
threshold
=
0.1
;
const
threshold
=
0.1
;
let
other
=
{
x
:
'
Other
'
,
y
:
0
,
values
:
[]
};
let
other
=
{
x
:
'
Other
'
,
y
:
0
};
let
newArray
=
[];
let
newArray
=
[];
for
(
let
item
of
dataArray
)
{
for
(
let
item
of
dataArray
)
{
const
portion
=
item
.
y
/
totalLength
;
const
portion
=
item
.
y
/
totalLength
;
if
(
portion
<
threshold
)
{
if
(
portion
<
threshold
)
{
other
.
y
+=
item
.
y
;
other
.
y
+=
item
.
y
;
other
.
values
.
push
(
item
.
values
);
}
else
{
}
else
{
newArray
.
push
(
item
);
newArray
.
push
(
item
);
}
}
...
@@ -69,21 +68,32 @@ let Pie = (props) => {
...
@@ -69,21 +68,32 @@ let Pie = (props) => {
if
(
resultCount
<
1
)
{
if
(
resultCount
<
1
)
{
return
''
;
return
''
;
}
}
const
grouped
=
_
.
groupBy
(
data
,
groupBy
);
// const grouped = _.groupBy(data, groupBy);
let
dataArray
=
[];
// let dataArray = [];
for
(
let
key
in
grouped
)
{
// for (let key in grouped) {
const
length
=
grouped
[
key
].
length
;
// const length = grouped[key].length;
dataArray
.
push
({
// dataArray.push({
x
:
key
,
// x: key,
y
:
length
,
// y: length,
values
:
grouped
[
key
]
// values: grouped[key]
});
// });
}
// }
let
placeLinks
=
0
;
let
dataArray
=
data
.
map
(
item
=>
{
const
msCount
=
parseInt
(
item
.
manuscriptCount
);
placeLinks
+=
msCount
;
return
{
x
:
item
.
label
,
y
:
msCount
,
};
});
dataArray
=
_
.
orderBy
(
dataArray
,
'
y
'
,
'
desc
'
);
dataArray
=
_
.
orderBy
(
dataArray
,
'
y
'
,
'
desc
'
);
dataArray
=
combineSmallGroups
(
dataArray
);
dataArray
=
combineSmallGroups
(
dataArray
,
placeLinks
);
const
legendArray
=
dataArray
.
map
(
group
=>
({
name
:
group
.
x
+
'
(
'
+
group
.
y
+
'
)
'
}));
const
legendArray
=
dataArray
.
map
(
group
=>
({
name
:
group
.
x
+
'
(
'
+
group
.
y
+
'
)
'
}));
const
legendHeigth
=
legendArray
.
length
*
33
;
const
legendHeigth
=
legendArray
.
length
*
33
;
const
pieTitle
=
resultCount
+
'
results for the query "
'
+
query
+
'
"
'
;
const
pieTitle
=
placeLinks
+
'
creation place links in total
'
;
return
(
return
(
<
div
className
=
{
classes
.
root
}
>
<
div
className
=
{
classes
.
root
}
>
...
@@ -102,14 +112,14 @@ let Pie = (props) => {
...
@@ -102,14 +112,14 @@ let Pie = (props) => {
}}
}}
colorScale
=
{
'
qualitative
'
}
colorScale
=
{
'
qualitative
'
}
data
=
{
dataArray
}
data
=
{
dataArray
}
labelComponent
=
{
<
PieTooltip
resultCount
=
{
resultCount
}
/>
}
labelComponent
=
{
<
PieTooltip
resultCount
=
{
placeLinks
}
/>
}
/>
/>
<
/Grid
>
<
/Grid
>
<
Grid
className
=
{
classes
.
legend
}
item
xs
=
{
12
}
sm
=
{
6
}
>
<
Grid
className
=
{
classes
.
legend
}
item
xs
=
{
12
}
sm
=
{
6
}
>
<
Paper
className
=
{
classes
.
legendPaper
}
>
<
Paper
className
=
{
classes
.
legendPaper
}
>
<
VictoryLegend
<
VictoryLegend
height
=
{
legendHeigth
}
height
=
{
legendHeigth
}
title
=
{
groupBy
}
title
=
{
'
Creation place
'
}
colorScale
=
{
'
qualitative
'
}
colorScale
=
{
'
qualitative
'
}
data
=
{
legendArray
}
data
=
{
legendArray
}
style
=
{{
style
=
{{
...
...
This diff is collapsed.
Click to expand it.
src/client/containers/MapApp.js
+
2
−
1
View file @
4a596b32
...
@@ -193,11 +193,12 @@ let MapApp = (props) => {
...
@@ -193,11 +193,12 @@ let MapApp = (props) => {
}
}
}
}
//console.log(creationPlaces)
let
statistics
=
''
;
let
statistics
=
''
;
if
((
oneColumnView
&&
options
.
resultFormat
===
'
statistics
'
)
||
(
!
oneColumnView
))
{
if
((
oneColumnView
&&
options
.
resultFormat
===
'
statistics
'
)
||
(
!
oneColumnView
))
{
statistics
=
(
statistics
=
(
<
div
className
=
{
oneColumnView
?
classes
.
statisticsOneColumn
:
classes
.
statistics
}
>
<
div
className
=
{
oneColumnView
?
classes
.
statisticsOneColumn
:
classes
.
statistics
}
>
<
Pie
data
=
{
manuscript
s
}
groupBy
=
{
props
.
search
.
groupBy
}
query
=
{
props
.
search
.
query
}
/
>
<
Pie
data
=
{
creationPlace
s
}
groupBy
=
{
props
.
search
.
groupBy
}
query
=
{
props
.
search
.
query
}
/
>
<
/div
>
<
/div
>
);
);
}
}
...
...
This diff is collapsed.
Click to expand it.
src/client/reducers/search.js
+
1
−
1
View file @
4a596b32
...
@@ -46,7 +46,7 @@ export const INITIAL_STATE = {
...
@@ -46,7 +46,7 @@ export const INITIAL_STATE = {
},
},
sortBy
:
'
author
'
,
sortBy
:
'
author
'
,
sortDirection
:
'
asc
'
,
sortDirection
:
'
asc
'
,
groupBy
:
'
creationPlace
'
,
groupBy
:
'
label
'
,
resultsQuery
:
''
,
resultsQuery
:
''
,
fetchingResults
:
false
,
fetchingResults
:
false
,
};
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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