Fork me on GitHub

>>> How can I get vega-lite to understand this as a date? I don't believe you can - that does not conform to Vega(Lite) "temporal" (date) format: So to make use of the various capabilities and formatting you will need to put it into a conforming form: "2019-02-012". This can also include a hour time stamp as part of it: "2019-02-012T08:00:00"


Then you can cast to ordinal and use timeunits or just indicate type "temporal". For example:


@dcj ^^^^ Note, those images (according to slack bot) may disappear soon...


@jsa-aerial thanks! I find it curious that there is not some way to give vega-lite something like the output of parse by constructing the result from access from various fields, but whatever


@dcj You might be able to do something like that with a transform. The idea would be to add a transform to your spec which takes your year, month, day map and turns it into a legal temporal string and assigns that to a new field. This would update the data stream with that added new field and formatted value. You would then use that in your encodings


@jsa-aerial good idea, I will likely try that. That will save me from having to directly pollute my data with formatted time strings. Again, that they only let you parse a string is sub-optimal, iMHO


Also, you could (probably even easier) just do this yourself:


I mean this doesn't pollute your data either and does what you want at the level of your specification as well.


@jsa-aerial Sweet! Works great. Thank you!


@jsa-aerial For some reason if I don't explicity parse the resulting vgldate, it labels 2019-02-01 as Jan 31! Cant't figure that one out!


@dcj WTF? Hmmm, sounds like that might be a bug. Can you post the offending map (with your date and the vgldate)? I'd like to see that. Or you could ping the devs in Vega(Lite) Slack. What versions are you using??