{ "$schema": "https://vega.github.io/schema/vega/v5.json", "background": "white", "padding": 5, "width": 600, "height": 300, "title": {"text": "Seattle Temperature Range, 2012-2015", "frame": "group"}, "style": "cell", "data": [ { "name": "source_0", "url": "data/seattle-weather.csv", "format": { "type": "csv", "parse": {"date": "date", "temp_max": "number", "temp_min": "number"} }, "transform": [ { "field": "date", "type": "timeunit", "units": ["month", "date"], "as": ["monthdate_date", "monthdate_date_end"] }, { "type": "aggregate", "groupby": ["monthdate_date"], "ops": ["max", "min"], "fields": ["temp_max", "temp_min"], "as": ["max_temp_max", "min_temp_min"] } ] } ], "marks": [ { "name": "marks", "type": "area", "style": ["area"], "sort": {"field": "datum[\"monthdate_date\"]"}, "from": {"data": "source_0"}, "encode": { "update": { "orient": {"value": "vertical"}, "fill": {"value": "#4c78a8"}, "opacity": {"value": 0.7}, "description": { "signal": "\"Date: \" + (timeFormat(datum[\"monthdate_date\"], '%b')) + \"; Daily Temperature Range (C): \" + (format(datum[\"max_temp_max\"], \"\")) + \"; Min of temp_min: \" + (format(datum[\"min_temp_min\"], \"\"))" }, "x": {"scale": "x", "field": "monthdate_date"}, "y": {"scale": "y", "field": "max_temp_max"}, "y2": {"scale": "y", "field": "min_temp_min"}, "defined": { "signal": "isValid(datum[\"monthdate_date\"]) && isFinite(+datum[\"monthdate_date\"]) && isValid(datum[\"max_temp_max\"]) && isFinite(+datum[\"max_temp_max\"])" } } } } ], "scales": [ { "name": "x", "type": "time", "domain": {"data": "source_0", "field": "monthdate_date"}, "range": [0, {"signal": "width"}] }, { "name": "y", "type": "linear", "domain": { "data": "source_0", "fields": ["max_temp_max", "min_temp_min"] }, "range": [{"signal": "height"}, 0], "nice": true, "zero": true } ], "axes": [ { "scale": "x", "orient": "bottom", "gridScale": "y", "grid": true, "tickCount": {"signal": "ceil(width/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "y", "orient": "left", "gridScale": "x", "grid": true, "tickCount": {"signal": "ceil(height/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "x", "orient": "bottom", "grid": false, "title": "Date", "format": "%b", "labelFlush": true, "labelOverlap": true, "tickCount": {"signal": "ceil(width/40)"}, "zindex": 0 }, { "scale": "y", "orient": "left", "grid": false, "title": "Daily Temperature Range (C)", "labelOverlap": true, "tickCount": {"signal": "ceil(height/40)"}, "zindex": 0 } ] }