Commit 359f4a54 authored by amarcic's avatar amarcic
Browse files

timeline, sort: handle missing periodSpan in case of multiple periods

parent 48821021
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment