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
e73844db
Commit
e73844db
authored
6 years ago
by
esikkala
Browse files
Options
Downloads
Patches
Plain Diff
Add statistics subview
parent
b678fb44
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/client/components/Pie.js
+77
-72
77 additions, 72 deletions
src/client/components/Pie.js
src/client/components/ViewTabs.js
+1
-1
1 addition, 1 deletion
src/client/components/ViewTabs.js
with
78 additions
and
73 deletions
src/client/components/Pie.js
+
77
−
72
View file @
e73844db
...
...
@@ -17,7 +17,6 @@ const styles = theme => ({
height
:
'
100%
'
,
display
:
'
flex
'
,
flexGrow
:
1
,
},
container
:
{
marginLeft
:
'
auto
'
,
...
...
@@ -62,89 +61,95 @@ const combineSmallGroups = (dataArray) => {
}
};
let
Pie
=
(
props
)
=>
{
const
{
classes
,
data
,
query
,
groupBy
}
=
props
;
const
resultCount
=
data
.
length
;
if
(
resultCount
<
1
)
{
return
''
;
class
Pie
extends
React
.
Component
{
componentDidMount
=
()
=>
{
this
.
props
.
fetchPlaces
(
'
creationPlaces
'
);
}
// const grouped = _.groupBy(data, groupBy);
// let dataArray = [];
// for (let key in grouped) {
// const length = grouped[key].length;
// dataArray.push({
// x: key,
// y: length,
// values: grouped[key]
// });
// }
let
placeLinks
=
0
;
let
dataArray
=
data
.
map
(
item
=>
{
const
msCount
=
parseInt
(
item
.
manuscriptCount
);
placeLinks
+=
msCount
;
return
{
x
:
item
.
prefLabel
,
y
:
msCount
,
};
});
dataArray
=
_
.
orderBy
(
dataArray
,
'
y
'
,
'
desc
'
);
dataArray
=
combineSmallGroups
(
dataArray
,
placeLinks
);
const
legendArray
=
dataArray
.
map
(
group
=>
({
name
:
group
.
x
+
'
(
'
+
group
.
y
+
'
)
'
}));
const
legendHeigth
=
legendArray
.
length
*
33
;
render
()
{
const
{
classes
,
data
}
=
this
.
props
;
const
resultCount
=
data
.
length
;
if
(
resultCount
<
1
)
{
return
''
;
}
// const grouped = _.groupBy(data, groupBy);
// let dataArray = [];
// for (let key in grouped) {
// const length = grouped[key].length;
// dataArray.push({
// x: key,
// y: length,
// values: grouped[key]
// });
// }
let
placeLinks
=
0
;
let
dataArray
=
data
.
map
(
item
=>
{
const
msCount
=
parseInt
(
item
.
manuscriptCount
);
placeLinks
+=
msCount
;
return
{
x
:
item
.
prefLabel
,
y
:
msCount
,
};
});
dataArray
=
_
.
orderBy
(
dataArray
,
'
y
'
,
'
desc
'
);
dataArray
=
combineSmallGroups
(
dataArray
,
placeLinks
);
const
legendArray
=
dataArray
.
map
(
group
=>
({
name
:
group
.
x
+
'
(
'
+
group
.
y
+
'
)
'
}));
const
legendHeigth
=
legendArray
.
length
*
33
;
const
pieTitle
=
placeLinks
+
'
creation place links in total
'
;
const
pieTitle
=
placeLinks
+
'
creation place links in total
'
;
return
(
<
div
className
=
{
classes
.
root
}
>
<
Grid
container
className
=
{
classes
.
container
}
>
<
Grid
className
=
{
classes
.
pie
}
item
xs
=
{
12
}
sm
=
{
6
}
>
<
VictoryLabel
style
=
{{
fontSize
:
'
14px
'
,
fontFamily
:
'
Roboto, Helvetica, Arial, sans-serif
'
,
}}
text
=
{
pieTitle
}
/
>
<
VictoryPie
padding
=
{{
left
:
0
,
bottom
:
0
,
top
:
32
}}
colorScale
=
{
'
qualitative
'
}
data
=
{
dataArray
}
labelComponent
=
{
<
PieTooltip
resultCount
=
{
placeLinks
}
/>
}
/>
<
/Grid
>
<
Grid
className
=
{
classes
.
legend
}
item
xs
=
{
12
}
sm
=
{
6
}
>
<
Paper
className
=
{
classes
.
legendPaper
}
>
<
VictoryLegend
height
=
{
legendHeigth
}
title
=
{
'
Creation place (manuscript count)
'
}
colorScale
=
{
'
qualitative
'
}
data
=
{
legendArray
}
return
(
<
div
className
=
{
classes
.
root
}
>
<
Grid
container
className
=
{
classes
.
container
}
>
<
Grid
className
=
{
classes
.
pie
}
item
xs
=
{
12
}
sm
=
{
6
}
>
<
VictoryLabel
style
=
{{
labels
:
{
fontFamily
:
'
Roboto, Helvetica, Arial, sans-serif
'
}
,
title
:
{
fontFamily
:
'
Roboto, Helvetica, Arial, sans-serif
'
}
,
fontSize
:
'
14px
'
,
fontFamily
:
'
Roboto, Helvetica, Arial, sans-serif
'
,
}}
containerComponent
=
{
<
VictoryContainer
responsive
=
{
false
}
width
=
{
250
}
/
>
}
text
=
{
pieTitle
}
/
>
<
/Paper
>
<
VictoryPie
padding
=
{{
left
:
0
,
bottom
:
0
,
top
:
32
}}
colorScale
=
{
'
qualitative
'
}
data
=
{
dataArray
}
labelComponent
=
{
<
PieTooltip
resultCount
=
{
placeLinks
}
/>
}
/>
<
/Grid
>
<
Grid
className
=
{
classes
.
legend
}
item
xs
=
{
12
}
sm
=
{
6
}
>
<
Paper
className
=
{
classes
.
legendPaper
}
>
<
VictoryLegend
height
=
{
legendHeigth
}
title
=
{
'
Creation place (manuscript count)
'
}
colorScale
=
{
'
qualitative
'
}
data
=
{
legendArray
}
style
=
{{
labels
:
{
fontFamily
:
'
Roboto, Helvetica, Arial, sans-serif
'
},
title
:
{
fontFamily
:
'
Roboto, Helvetica, Arial, sans-serif
'
},
}}
containerComponent
=
{
<
VictoryContainer
responsive
=
{
false
}
width
=
{
250
}
/
>
}
/
>
<
/Paper
>
<
/Grid
>
<
/Grid
>
<
/
Grid
>
<
/div
>
);
}
;
<
/
div
>
);
}
}
Pie
.
propTypes
=
{
classes
:
PropTypes
.
object
.
isRequired
,
data
:
PropTypes
.
array
.
isRequired
,
groupBy
:
PropTypes
.
string
.
isRequired
,
query
:
PropTypes
.
string
.
isRequired
,
fetchPlaces
:
PropTypes
.
func
.
isRequired
};
export
default
withStyles
(
styles
)(
Pie
);
This diff is collapsed.
Click to expand it.
src/client/components/ViewTabs.js
+
1
−
1
View file @
e73844db
...
...
@@ -44,7 +44,7 @@ class ViewTabs extends React.Component {
<
Tab
icon
=
{
<
CalendarViewDayIcon
/>
}
label
=
"
table
"
component
=
{
Link
}
to
=
"
/manuscripts/table
"
/>
<
Tab
icon
=
{
<
AddLocationIcon
/>
}
label
=
"
creation places
"
component
=
{
Link
}
to
=
"
/manuscripts/creation_places
"
/>
<
Tab
icon
=
{
<
RedoIcon
/>
}
label
=
"
migrations
"
component
=
{
Link
}
to
=
"
/manuscripts/migrations
"
/>
<
Tab
icon
=
{
<
PieChartIcon
/>
}
label
=
"
statistics
"
/>
<
Tab
icon
=
{
<
PieChartIcon
/>
}
label
=
"
statistics
"
component
=
{
Link
}
to
=
"
/manuscripts/statistics
"
/>
<
/Tabs
>
<
/Paper
>
);
...
...
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