Replies: 1 comment
-
Hi @qnzhou, As for a pure Altair/Vega-Lite solution, the only option I can think of is to use a calculate transform to convert the date string (e.g. Something like: alt.Chart(url).transform_calculate(
date="datum['date'] + 'T00:00:00'",
).mark_bar().encode(...) Hope that helps! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
It seems to be a known problem that Altair/VegaLite interprets dates like
2018-01-01
using UTC time zone, but visualizes the same data using local time zone (e.g. #2077). The proposed solution is to either use Pandas which provides more consistent time zone handling or useutc
prefix to visualize dates in UTC time zone.However, the dataset I have contains more than 5000 rows, and I would like to load it directly from the URL so Altair does not dump the data together with Vega-Lite json spec. This constraint means I cannot use pandas to preprocess my data. Using
utc
prefix is viable, but I feel it makes the code confusing as the dates are really not in UTC... Is there any way of properly fixing the time zone problem directly within Altair or Vega-Lite? Thanks!Beta Was this translation helpful? Give feedback.
All reactions