{ "$schema": "https://vega.github.io/schema/vega/v5.json", "background": "white", "padding": 5, "width": 600, "height": 400, "style": "cell", "data": [ { "name": "source_0", "url": "data/disasters.csv", "format": {"type": "csv", "parse": {"Year": "date:'%Y'"}}, "transform": [ {"type": "filter", "expr": "datum.Entity !== 'All natural disasters'"}, { "type": "filter", "expr": "(isDate(datum[\"Year\"]) || (isValid(datum[\"Year\"]) && isFinite(+datum[\"Year\"]))) && isValid(datum[\"Deaths\"]) && isFinite(+datum[\"Deaths\"])" } ] } ], "marks": [ { "name": "marks", "type": "symbol", "style": ["circle"], "from": {"data": "source_0"}, "encode": { "update": { "opacity": {"value": 0.8}, "stroke": {"value": "black"}, "strokeWidth": {"value": 1}, "fill": {"scale": "color", "field": "Entity"}, "ariaRoleDescription": {"value": "circle"}, "description": { "signal": "\"Year: \" + (timeFormat(datum[\"Year\"], '%b %d, %Y')) + \"; Entity: \" + (isValid(datum[\"Entity\"]) ? datum[\"Entity\"] : \"\"+datum[\"Entity\"]) + \"; Annual Global Deaths: \" + (format(datum[\"Deaths\"], \"\"))" }, "x": {"scale": "x", "field": "Year"}, "y": {"scale": "y", "field": "Entity"}, "size": {"scale": "size", "field": "Deaths"}, "shape": {"value": "circle"} } } } ], "scales": [ { "name": "x", "type": "time", "domain": {"data": "source_0", "field": "Year"}, "range": [0, {"signal": "width"}] }, { "name": "y", "type": "point", "domain": {"data": "source_0", "field": "Entity", "sort": true}, "range": [0, {"signal": "height"}], "padding": 0.5 }, { "name": "color", "type": "ordinal", "domain": {"data": "source_0", "field": "Entity", "sort": true}, "range": "category" }, { "name": "size", "type": "linear", "domain": {"data": "source_0", "field": "Deaths"}, "range": [0, 5000], "zero": true } ], "axes": [ { "scale": "x", "orient": "bottom", "grid": false, "title": "Year", "labelFlush": true, "labelOverlap": true, "tickCount": {"signal": "ceil(width/40)"}, "zindex": 0 }, {"scale": "y", "orient": "left", "grid": false, "zindex": 0} ], "legends": [ { "clipHeight": 30, "title": "Annual Global Deaths", "size": "size", "symbolType": "circle", "encode": { "symbols": { "update": { "fill": {"value": "black"}, "stroke": {"value": "black"}, "fillOpacity": {"value": 0.8}, "opacity": {"value": 0.8} } } } } ] }