{ "$schema": "https://vega.github.io/schema/vega/v5.json", "background": "white", "padding": 5, "width": 200, "height": 20, "style": "cell", "data": [ { "name": "source_0", "url": "data/seattle-weather.csv", "format": {"type": "csv", "parse": {"date": "date"}}, "transform": [ { "field": "date", "type": "timeunit", "units": ["year", "month"], "as": ["yearmonth_date", "yearmonth_date_end"] }, { "type": "aggregate", "groupby": ["yearmonth_date"], "ops": ["mean"], "fields": ["temp_max"], "as": ["mean_temp_max"] }, { "type": "filter", "expr": "isValid(datum[\"mean_temp_max\"]) && isFinite(+datum[\"mean_temp_max\"]) && (isDate(datum[\"yearmonth_date\"]) || (isValid(datum[\"yearmonth_date\"]) && isFinite(+datum[\"yearmonth_date\"])))" } ] } ], "marks": [ { "name": "marks", "type": "symbol", "style": ["point"], "from": {"data": "source_0"}, "encode": { "update": { "fill": {"value": "transparent"}, "stroke": {"scale": "color", "field": "yearmonth_date"}, "ariaRoleDescription": {"value": "point"}, "description": { "signal": "\"Mean of temp_max: \" + (format(datum[\"mean_temp_max\"], \"\")) + \"; date (year-month): \" + (timeFormat(datum[\"yearmonth_date\"], timeUnitSpecifier([\"year\",\"month\"], {\"year-month\":\"%b %Y \",\"year-month-date\":\"%b %d, %Y \"})))" }, "x": {"scale": "x", "field": "mean_temp_max"}, "y": {"signal": "height", "mult": 0.5} } } } ], "scales": [ { "name": "x", "type": "linear", "domain": {"data": "source_0", "field": "mean_temp_max"}, "range": [0, {"signal": "width"}], "nice": true, "zero": true }, { "name": "color", "type": "time", "domain": {"data": "source_0", "field": "yearmonth_date"}, "range": "ramp", "interpolate": "hcl" } ], "axes": [ { "scale": "x", "orient": "bottom", "grid": true, "tickCount": {"signal": "ceil(width/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "x", "orient": "bottom", "grid": false, "title": "Mean of temp_max", "labelFlush": true, "labelOverlap": true, "tickCount": {"signal": "ceil(width/40)"}, "zindex": 0 } ], "legends": [ { "stroke": "color", "format": { "signal": "timeUnitSpecifier([\"year\",\"month\"], {\"year-month\":\"%b %Y \",\"year-month-date\":\"%b %d, %Y \"})" }, "gradientLength": {"signal": "clamp(height, 64, 200)"}, "title": "date (year-month)" } ] }