Reputation: 904
I'm currently designing a financial timescale with quite a large dataset, as a result I have noticed that using d3's built-in timescale doesn't really allow for "clipping" parts of the day out, and results in quite an ugly looking graph if I'm wanting to span say, weeks or months (a lot of flat lines like this):
I'm aware that I can use ordinal scales and input my own data but with a dataset of over 2000 points for just a week, this isn't really feasible. I was wondering if there were any plug-ins for d3 that I could use to have custom defined timescales in my chart so that I could clip say, from 9pm to 9am and exclude weekends?
Upvotes: 1
Views: 1092
Reputation: 4511
The project d3 discontinuous scale could be useful for your use case.
They have an example to remove weekends https://github.com/d3fc/d3fc-discontinuous-scale/blob/1a2e551fbcaec2852581e20c30e3e5fd7c3e9b32/src/discontinuity/skipWeekends.js that could be a good starting point.
Also here's a blog post and a gist that can be useful too
Upvotes: 2