vega-lite
vega-lite copied to clipboard
Time unit marks repeat unnecessarily on the axis
When plotting by say Year or Quarter, the axis marks will often just repeat the same thing multiple times, when that seems to provide no benefit.
![CleanShot 2022-06-08 at 12 59 17@2x](https://user-images.githubusercontent.com/6945891/172674382-ab976869-09c4-4933-865b-0479d1629f06.png)
I'm plotting distinct counts (here, the same as just counts) against year. You can see that the x-axis has 2021 2021 2021 2021 2022 2022
etc. Similarly if you change the time unit to quarter you see the same thing:
![CleanShot 2022-06-08 at 13 00 51@2x](https://user-images.githubusercontent.com/6945891/172674727-93c2921f-f4c4-4ee8-9bc8-ba238a52af8c.png)
Thanks!
No idea if this is a bug or not but you can get your desired behaviour by changing the type to ordinal.
Thanks @PBI-David , definitely avoids the problem here, although if you have a gap in the middle, it's ignored, e.g. if you have no Q3, it just goes straight from Q2 to Q4:
![CleanShot 2022-06-08 at 14 42 20@2x](https://user-images.githubusercontent.com/6945891/172692647-eb5d9011-9390-4cdf-99be-4c98a664d3ae.png)
(link)
But temporal does what I consider the right thing here (maybe):
![CleanShot 2022-06-08 at 14 43 04@2x](https://user-images.githubusercontent.com/6945891/172692779-7c5008dc-713d-4ffe-9578-0e6b1314a209.png)
Yeah, fair point. You'd have to back fill your date dimension with a full set of dates for this to work as you want. I'll be interested to hear what the devs have to say.
Oh nice @PBI-David, that's pretty good. Funny that you can do it for quarter too, but the editor complains! So basically the solution here is maybe either some sort of "smarter" defaults, or maybe at least a minimum tick count (bounded by max displayable bars plus one).
Yes, not sure why the editor complains about quarter. I also can't get tickBand:center working for some reason. Let's see what the devs say.