Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
SPP 2143 Learning Through Connecting
ltc_website
Commits
359f4a54
Commit
359f4a54
authored
Sep 21, 2021
by
amarcic
Browse files
timeline, sort: handle missing periodSpan in case of multiple periods
parent
48821021
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/components/Timeline/TimelineChart.jsx
View file @
359f4a54
...
...
@@ -16,13 +16,14 @@ export const TimelineChart = (props) => {
const
xDomain
=
getTimeRangeOfTimelineData
(
props
.
filteredTimelineData
,
"
period
"
);
const
dataUnsorted
=
newGroupByPeriods
(
props
.
filteredTimelineData
);
const
data
=
dataUnsorted
&&
new
Map
([...
dataUnsorted
.
entries
()]
//sort by period start year
.
sort
(
(
a
,
b
)
=>
a
[
1
].
periodSpan
[
0
]
-
b
[
1
].
periodSpan
[
0
]
));
a
[
1
].
periodSpan
?.
[
0
]
-
b
[
1
].
periodSpan
?.
[
0
]
));
const
timelineData
=
{
xDomain
,
data
,
svgRef
};
//console.log("filteredTimelineData: ", props.filteredTimelineData);
//
console.log("grouped by periods: ", data)
console
.
log
(
"
grouped by periods
and sorted
:
"
,
data
)
//console.log("sorted data: ", dataUnsorted)
//setting up the svg after first render
...
...
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!
Cancel
Please
register
or
sign in
to comment