Extension:Graph/Demo/Airports/SandBox

From http://vega.github.io/vega-editor/?spec=airports { "width": 1, "height": 1, "padding": "auto", "data": [ {     "name": "source", "url": "wikidatasparql://query.wikidata.org/?query=SELECT%20%3Fitem%20%3FitemLabel%20%28max%28%3Fnumber%29%20as%20%3Fpassengers%29%20%0A%3Fyear%0Awith%20%7B%0A%20%20select%20%3Fitem%20%3Fstatement%20%3Fyear%20%3Ftimevalue%20%3Fnumberperperiod%7B%0A%20%20%20%20%3Fitem%20wdt%3AP238%20%3FIATA%0A%20VALUES%20%3FIATA%20%7B%22ICN%22%7D.%0A%20%20%20%20%3Fitem%20p%3AP3872%20%3Fstatement.%0A%20%20%20%20%3Fstatement%20pqv%3AP585%20%3Ftimevalue%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3B%20ps%3AP3872%20%3Fnumberperperiod.%0A%20%20%20%20%3Ftimevalue%20wikibase%3AtimeValue%20%3Fdate%20.%0A%20%20%20%20optional%20%7B%20%3Fstatement%20pq%3AP518%20%3Fapplies%20.%7D%0Afilter%28bound%28%3Fapplies%29%3Dfalse%20%7C%7C%20%3Fapplies%20%3D%20wd%3AQ2165236%20%29%0Abind%28if%28bound%28%3Fapplies%29%3Dfalse%2C%22no%20applies%22%2C%22everywhere%22%29%20as%20%3Fwhere%20%29%0AMINUS%20%7B%20%3Fstatement%20wikibase%3Arank%20wikibase%3ADeprecatedRank%20%7D%0Abind%20%28YEAR%28%3Fdate%29%20AS%20%3Fyear%29%0AFILTER%20%28%3Fyear%20%3E1949%29.%0AFILTER%20%28%3Fyear%20%3C%20year%28now%28%29%29%29.%0A%7D%0A%7D%20as%20%25airport%0Awhere%20%7B%0A%20%20%7B%0Aselect%20%3Fitem%20%3Fyear%20%28sum%28%3Fnumberperperiod%29%20as%20%3Fnumber%29%20%7B%0Ainclude%20%25airport%20.%0A%3Ftimevalue%20wikibase%3AtimePrecision%20%3Fprec%20filter%20%28%20%3Fprec%20%3E%209%20%29%0A%7D%20group%20by%20%3Fitem%20%20%3Fyear%0A%20%20%7D%20union%20%7B%0A%20%20%20%20%20%20%3Ftimevalue%20wikibase%3AtimePrecision%209%20.%0A%20%20%20%20bind%20%28%3Fnumberperperiod%20as%20%3Fnumber%29%0A%20%20%20%20%20%20include%20%25airport%0A%20%20%7D%20.%0A%20%20%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22fr%22.%20%7D%0A%7D%20group%20by%20%3Fitem%20%3FitemLabel%20%3Fyear%0Aorder%20by%20%3Fitem%20desc%20%28%3Fyear%29", "format": {"type": "json","parse": {"passengers": "number"}}, "transform": [ {         "type": "filter", "test": "datum[\"passengers\"] !== null && !isNaN(datum[\"passengers\"])" }     ]    },    {      "name": "layout", "source": "source", "transform": [ {         "type": "aggregate", "summarize": [{"field": "year","ops": ["distinct"]}] },       {          "type": "formula", "field": "width", "expr": "(datum[\"distinct_year\"] + 1) * 21" },       {"type": "formula","field": "height","expr": "400"} ]   }  ],  "marks": [ {     "name": "root", "type": "group", "from": {"data": "layout"}, "properties": {"update": {"width": {"field": "width"},"height": {"field": "height"}}}, "marks": [ {         "name": "marks", "type": "symbol", "from": {"data": "source"}, "properties": { "update": { "x": {"scale": "x","field": "year"}, "y": {"scale": "y","field": "passengers"}, "size": {"value": 30}, "shape": {"value": "circle"}, "strokeWidth": {"value": 2}, "opacity": {"value": 0.7}, "stroke": {"value": "#4682b4"}, "fill": {"value": "transparent"} }         }        }      ],      "scales": [ {         "name": "x", "type": "ordinal", "domain": {"data": "source","field": "year","sort": true}, "bandSize": 21, "round": true, "padding": 1, "points": true },       {          "name": "y", "type": "linear", "domain": {"data": "source","field": "passengers"}, "rangeMin": 400, "rangeMax": 0, "round": true, "nice": true, "zero": true }     ],      "axes": [ {         "type": "x", "scale": "x", "grid": false, "ticks": 5, "title": "year", "properties": { "labels": { "text": {"template": ""}, "angle": {"value": 270}, "align": {"value": "right"}, "baseline": {"value": "middle"} }         }        },        {          "type": "y", "scale": "y", "format": "s", "grid": true, "layer": "back", "title": "passengers" }     ]    }  ] }