data = {
const rowConversionFunction = ({
"Name": name,
"Visits": visits
}) => {
return {
name,
visits: +visits
}};
const data5Jul = await d3.tsvParse(tsv5Jul, rowConversionFunction);
const data25Jul = await d3.tsvParse(tsv25Jul, rowConversionFunction);
let dataObjectTarget = [];
data25Jul.forEach(after => {
if (data5Jul.some(before => before.name === after.name)) {
dataObjectTarget.push({
name: after.name,
visits: [data5Jul.find(before => before.name === after.name).visits, after.visits]
})
}
else {
}
});
const extraPropertiesSource = {
columns: ["5 July 2020", "25 July 2020"],
xAxisLabel: "Goodies",
yAxisLabel: "Cats",
observation: "",
title: "Changes in cat visits.",
};
return Object.assign(dataObjectTarget, extraPropertiesSource);
}