1

I have a dc line chart. The x-axis is dates. The y axis is the amount of times a certain activity occurred. Here's the data for the crossfilter:

const data = [{
  activites: 5,
  date: new Date('January 01, 2020')
},{
  activites: 2,
  date: new Date('January 02, 2020')
},{
  activites: 7,
  date: new Date('January 03, 2020')
},{
  activites: 4,
  date: new Date('January 10, 2020')
},
{
  activites: 9,
  date: new Date('January 11, 2020')
}];

Based on the data above, I was hoping that for Jan 3 - 10 the line would slope from '7' (Jan 3) down to '0' (Jan 4 - 9) and then finally slope back up to '4' (Jan 10). However, in reality the line slope went from '7' to '4', giving the impression that the intermediate days of Jan 4- 9 have activities in their data. Why didn't the line go down to zero to indicate that those days have no data for them?

Thank you

Gordon
  • 19,811
  • 4
  • 36
  • 74
wondering
  • 21
  • 1
  • dc.js and crossfilter don't really know the resolution of your data and where there "should" be points. Here is an earlier solution, lmk if it doesn't work for you, or if you need further explanation. Btw, you may want to quantize to days using [d3.timeDay](https://github.com/d3/d3-time#timeDay), as shown in the question, if it's possible that some of your inputs fall within a day, so that they aggregate to day and don't create extra points between days. – Gordon Jan 31 '20 at 13:39

0 Answers0