timestamped = topHashtags.map(hashtag=>{
const postsIndexes = postsHashtags
.map((ph, index)=>({index: index,contains: ph.indexOf(hashtag)>-1}))
.filter(p=>p.contains)
.map(p=>p.index)
const dates = postsIndexes
.map(index=>{
const date = data[index].timestamp.split(" ")[0].split("/")
const [day, month, year] = date
const date_complete = `20${year}-${month}-${day}`
if (date_complete.length > 10) {
console.log(data[index])
}
return date_complete
})
const datesCount = d3.groups(dates.flat(), d => d)
.map(d=>({date:d[0],count:d[1].length}))
.map(d=>({hashtag:hashtag, ...d}))
return datesCount
}).flat()