{ "$schema": "https://vega.github.io/schema/vega/v5.json", "description": "Parsing a date in utc and outputting utc.", "background": "white", "padding": 5, "width": 20, "style": "cell", "data": [ { "name": "source_0", "values": [{"date": "2011-10-10"}, {"date": "2011-10-12"}] }, { "name": "data_0", "source": "source_0", "transform": [ {"type": "formula", "expr": "toDate(datum[\"date\"])", "as": "date"}, { "field": "date", "type": "timeunit", "units": ["hours"], "timezone": "utc", "as": ["utchours_date", "utchours_date_end"] } ] } ], "signals": [ {"name": "y_step", "value": 20}, { "name": "height", "update": "bandspace(domain('y').length, 1, 0.5) * y_step" } ], "marks": [ { "name": "marks", "type": "symbol", "style": ["point"], "from": {"data": "data_0"}, "encode": { "update": { "opacity": {"value": 0.7}, "fill": {"value": "transparent"}, "stroke": {"value": "#4c78a8"}, "ariaRoleDescription": {"value": "point"}, "description": { "signal": "\"time: \" + (timeFormat(datum[\"utchours_date\"], timeUnitSpecifier([\"hours\"], {\"year-month\":\"%b %Y \",\"year-month-date\":\"%b %d, %Y \"})))" }, "x": {"signal": "width", "mult": 0.5}, "y": {"scale": "y", "field": "utchours_date"} } } } ], "scales": [ { "name": "y", "type": "point", "domain": {"data": "data_0", "field": "utchours_date", "sort": true}, "range": {"step": {"signal": "y_step"}}, "padding": 0.5 } ], "axes": [ { "scale": "y", "orient": "left", "grid": false, "title": "time", "format": { "signal": "timeUnitSpecifier([\"hours\"], {\"year-month\":\"%b %Y \",\"year-month-date\":\"%b %d, %Y \"})" }, "formatType": "time", "labelOverlap": true, "zindex": 0 } ] }