This message was deleted.
# help
s
This message was deleted.
f
You can control the visible days and their offset/order via
domain
and `ticks`:
Copy code
domain: [-1, 1, 2, 3, 4, 5, 6, 0], // hide 0 and 6 (weekends); use -1 for labels
      ticks: [0, 1, 2, 3, 4, 5, 6], // don't draw a tick for -1
s
Thanks for your suggestion Fabian, I can see this is Mike's original approach. I did try this, but it has an odd side effect of shifting any data plotted for Sunday to the next week. E.g. in this screenshot, 27 Feb should appear one cell to the left:
f
I see, in that case you also need to replace d3.utcWeek with d3.utcMonday in the calendar cell.
s
Thanks again for your input Fabian. I'm taking a slightly different approach: I'm parsing my data before plotting it so that each row has a day reference (1-7) and a week reference (1-53) as per ISO8601. Then I am using those keys to plot marks via Plot.dot(). So I can get all the dots in the right place, I just couldn't make the ticks behave nicely. In the end, to format the y ticks I have created an array of day names and refer to it as
tickFormat: t => daynames[t]
For anyone interested in a work in progress of a lightweight version of the original Plot calendar: https://observablehq.com/d/49adab8b71670635
m
It’s already some time ago but here are two links when I tinkered with Plot to get a calendarπŸ“… https://observablehq.com/@ee2dev/plot-exploration-how-to-customize-the-calendar-visualizat https://observablehq.com/d/f3c6319bdde35775
s
Thanks for sharing Mihael! Great to see all the different tweaks. I'm intrigued to see that you solved the Monday-first conundrum much better than I did... I will have to dig back in this evening!
m
@Sam Mead Feel free to ask if you have questions and in the last months observable Plot progressed quite a bit , so there are probably shorter solution possible now. But the Monday-based weekdays should work fine. Btw. I could not open your link - maybe your notebook is not public ?!
s
Thanks Mihael – I just opened it up to be public. Last night I reviewed your weather calendars a bit more thoroughly and picked up loads of things. Thanks for sharing! I think my calendar is in need of a refactor
πŸ™Œ 1