Module

x/vega_lite/examples/compiled/interactive_dashboard_europe_pop.vg.json

A concise grammar of interactive graphics, built on Vega.
Latest
File
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512
{ "$schema": "https://vega.github.io/schema/vega/v5.json", "background": "white", "padding": 5, "data": [ {"name": "brush_store"}, { "name": "source_0", "values": [ { "Code": "ALB", "Country": "Albania", "Population_ages_15_64_of_total": 69.0574620108062, "Population_ages_65_and_above_of_total": 12.3963338706153 }, { "Code": "ARM", "Country": "Armenia", "Population_ages_15_64_of_total": 70.7901217876325, "Population_ages_65_and_above_of_total": 10.8259833940416 }, { "Code": "AUT", "Country": "Austria", "Population_ages_15_64_of_total": 67.0332301646914, "Population_ages_65_and_above_of_total": 18.7591300503032 }, { "Code": "AZE", "Country": "Azerbaijan", "Population_ages_15_64_of_total": 72.4553638068118, "Population_ages_65_and_above_of_total": 5.62608981288436 }, { "Code": "BLR", "Country": "Belarus", "Population_ages_15_64_of_total": 69.9508710458679, "Population_ages_65_and_above_of_total": 13.9809217228707 }, { "Code": "BEL", "Country": "Belgium", "Population_ages_15_64_of_total": 64.8307418795963, "Population_ages_65_and_above_of_total": 18.2248164293518 }, { "Code": "BIH", "Country": "Bosnia and Herzegovina", "Population_ages_15_64_of_total": 71.0579632250127, "Population_ages_65_and_above_of_total": 15.4439567753232 }, { "Code": "BGR", "Country": "Bulgaria", "Population_ages_15_64_of_total": 65.8285064995643, "Population_ages_65_and_above_of_total": 20.0274777416446 }, { "Code": "CHI", "Country": "Channel Islands", "Population_ages_15_64_of_total": 68.022872223444, "Population_ages_65_and_above_of_total": 17.2684065195611 }, { "Code": "HRV", "Country": "Croatia", "Population_ages_15_64_of_total": 66.1722696675744, "Population_ages_65_and_above_of_total": 18.9370747517226 }, { "Code": "CYP", "Country": "Cyprus", "Population_ages_15_64_of_total": 70.6035355702394, "Population_ages_65_and_above_of_total": 12.8454475242427 }, { "Code": "CZE", "Country": "Czech Republic", "Population_ages_15_64_of_total": 66.8821170374875, "Population_ages_65_and_above_of_total": 18.075987656862 }, { "Code": "DNK", "Country": "Denmark", "Population_ages_15_64_of_total": 64.1595524918413, "Population_ages_65_and_above_of_total": 18.9594398104384 }, { "Code": "EST", "Country": "Estonia", "Population_ages_15_64_of_total": 65.1524732621339, "Population_ages_65_and_above_of_total": 18.7597043330657 }, { "Code": "FIN", "Country": "Finland", "Population_ages_15_64_of_total": 63.1844856787288, "Population_ages_65_and_above_of_total": 20.4771837047151 }, { "Code": "FRA", "Country": "France", "Population_ages_15_64_of_total": 62.3959557946308, "Population_ages_65_and_above_of_total": 19.1205109623995 }, { "Code": "GEO", "Country": "Georgia", "Population_ages_15_64_of_total": 68.6468764031909, "Population_ages_65_and_above_of_total": 14.0256592059827 }, { "Code": "DEU", "Country": "Germany", "Population_ages_15_64_of_total": 65.8735239308132, "Population_ages_65_and_above_of_total": 21.2406519413629 }, { "Code": "GRC", "Country": "Greece", "Population_ages_15_64_of_total": 64.001114781101, "Population_ages_65_and_above_of_total": 21.396558181815 }, { "Code": "HUN", "Country": "Hungary", "Population_ages_15_64_of_total": 67.6233936744744, "Population_ages_65_and_above_of_total": 17.8178985477761 }, { "Code": "ISL", "Country": "Iceland", "Population_ages_15_64_of_total": 65.9664567048645, "Population_ages_65_and_above_of_total": 13.7138954238446 }, { "Code": "IRL", "Country": "Ireland", "Population_ages_15_64_of_total": 65.079935543936, "Population_ages_65_and_above_of_total": 13.1395030143128 }, { "Code": "ITA", "Country": "Italy", "Population_ages_15_64_of_total": 63.8797421672762, "Population_ages_65_and_above_of_total": 22.4098759007142 }, { "Code": "KAZ", "Country": "Kazakhstan", "Population_ages_15_64_of_total": 66.5468630019269, "Population_ages_65_and_above_of_total": 6.73573774316427 }, { "Code": "XKX", "Country": "Kosovo", "Population_ages_15_64_of_total": 67.5956284153006, "Population_ages_65_and_above_of_total": 6.77595628415301 }, { "Code": "KGZ", "Country": "Kyrgyz Republic", "Population_ages_15_64_of_total": 64.3715060803419, "Population_ages_65_and_above_of_total": 4.22684522224216 }, { "Code": "LVA", "Country": "Latvia", "Population_ages_15_64_of_total": 65.7100750417533, "Population_ages_65_and_above_of_total": 19.3677959383975 }, { "Code": "LTU", "Country": "Lithuania", "Population_ages_15_64_of_total": 66.637321711156, "Population_ages_65_and_above_of_total": 18.8477993888977 }, { "Code": "LUX", "Country": "Luxembourg", "Population_ages_15_64_of_total": 69.5849129798452, "Population_ages_65_and_above_of_total": 13.981414540389 }, { "Code": "MDA", "Country": "Moldova", "Population_ages_15_64_of_total": 74.3086639941979, "Population_ages_65_and_above_of_total": 9.95793208822932 }, { "Code": "MNE", "Country": "Montenegro", "Population_ages_15_64_of_total": 67.7000420274825, "Population_ages_65_and_above_of_total": 13.6450291715472 }, { "Code": "NLD", "Country": "Netherlands", "Population_ages_15_64_of_total": 65.2462589355619, "Population_ages_65_and_above_of_total": 18.2304693863117 }, { "Code": "NOR", "Country": "Norway", "Population_ages_15_64_of_total": 65.6985354157875, "Population_ages_65_and_above_of_total": 16.3329186310334 }, { "Code": "POL", "Country": "Poland", "Population_ages_15_64_of_total": 69.5203957630148, "Population_ages_65_and_above_of_total": 15.5333238336452 }, { "Code": "PRT", "Country": "Portugal", "Population_ages_15_64_of_total": 65.1552111668212, "Population_ages_65_and_above_of_total": 20.7914682047571 }, { "Code": "ROU", "Country": "Romania", "Population_ages_15_64_of_total": 67.1654214752418, "Population_ages_65_and_above_of_total": 17.3139967333842 }, { "Code": "RUS", "Country": "Russian Federation", "Population_ages_15_64_of_total": 69.8822387917186, "Population_ages_65_and_above_of_total": 13.3658426985027 }, { "Code": "SRB", "Country": "Serbia", "Population_ages_15_64_of_total": 66.6173161713822, "Population_ages_65_and_above_of_total": 17.0823666319247 }, { "Code": "SVK", "Country": "Slovak Republic", "Population_ages_15_64_of_total": 71.0312889656187, "Population_ages_65_and_above_of_total": 13.8450659736415 }, { "Code": "SVN", "Country": "Slovenia", "Population_ages_15_64_of_total": 67.2471833486012, "Population_ages_65_and_above_of_total": 17.9683834689382 }, { "Code": "ESP", "Country": "Spain", "Population_ages_15_64_of_total": 66.3288553181877, "Population_ages_65_and_above_of_total": 18.7894661035796 }, { "Code": "SWE", "Country": "Sweden", "Population_ages_15_64_of_total": 62.7731014069742, "Population_ages_65_and_above_of_total": 19.9420190919181 }, { "Code": "CHE", "Country": "Switzerland", "Population_ages_15_64_of_total": 67.1827980001116, "Population_ages_65_and_above_of_total": 18.0418460178465 }, { "Code": "TJK", "Country": "Tajikistan", "Population_ages_15_64_of_total": 62.1561674893051, "Population_ages_65_and_above_of_total": 3.00628812918872 }, { "Code": "TUR", "Country": "Turkey", "Population_ages_15_64_of_total": 66.790794681757, "Population_ages_65_and_above_of_total": 7.53869755140193 }, { "Code": "TKM", "Country": "Turkmenistan", "Population_ages_15_64_of_total": 67.6209109068909, "Population_ages_65_and_above_of_total": 4.15507428861104 }, { "Code": "UKR", "Country": "Ukraine", "Population_ages_15_64_of_total": 69.7661921081373, "Population_ages_65_and_above_of_total": 15.3061908119499 }, { "Code": "GBR", "Country": "United Kingdom", "Population_ages_15_64_of_total": 64.4654096116544, "Population_ages_65_and_above_of_total": 17.7603695294859 }, { "Code": "UZB", "Country": "Uzbekistan", "Population_ages_15_64_of_total": 66.8223460574423, "Population_ages_65_and_above_of_total": 4.6577368288371 }, { "Code": "MKD", "Country": "Macedonia", "Population_ages_15_64_of_total": 70.7240914276147, "Population_ages_65_and_above_of_total": 12.3228189427425 } ] }, { "name": "data_1", "source": "source_0", "transform": [ { "type": "filter", "expr": "isValid(datum[\"Population_ages_15_64_of_total\"]) && isFinite(+datum[\"Population_ages_15_64_of_total\"])" } ] }, { "name": "data_2", "source": "source_0", "transform": [ { "type": "filter", "expr": "isValid(datum[\"Population_ages_65_and_above_of_total\"]) && isFinite(+datum[\"Population_ages_65_and_above_of_total\"])" } ] }, { "name": "data_3", "source": "source_0", "transform": [ { "type": "filter", "expr": "isValid(datum[\"Population_ages_15_64_of_total\"]) && isFinite(+datum[\"Population_ages_15_64_of_total\"]) && isValid(datum[\"Population_ages_65_and_above_of_total\"]) && isFinite(+datum[\"Population_ages_65_and_above_of_total\"])" } ] } ], "signals": [ {"name": "concat_0_width", "value": 200}, {"name": "concat_0_height", "value": 700}, {"name": "concat_1_width", "value": 200}, {"name": "concat_1_height", "value": 700}, {"name": "concat_2_width", "value": 260}, {"name": "concat_2_height", "value": 260}, { "name": "unit", "value": {}, "on": [ {"events": "mousemove", "update": "isTuple(group()) ? group() : unit"} ] }, { "name": "brush", "update": "vlSelectionResolve(\"brush_store\", \"union\")" } ], "layout": {"padding": 20, "bounds": "full", "align": "each"}, "marks": [ { "type": "group", "name": "concat_0_group", "style": "cell", "encode": { "update": { "width": {"signal": "concat_0_width"}, "height": {"signal": "concat_0_height"} } }, "signals": [ { "name": "brush_y", "value": [], "on": [ { "events": { "source": "scope", "type": "mousedown", "filter": [ "!event.item || event.item.mark.name !== \"brush_brush\"" ] }, "update": "[y(unit), y(unit)]" }, { "events": { "source": "window", "type": "mousemove", "consume": true, "between": [ { "source": "scope", "type": "mousedown", "filter": [ "!event.item || event.item.mark.name !== \"brush_brush\"" ] }, {"source": "window", "type": "mouseup"} ] }, "update": "[brush_y[0], clamp(y(unit), 0, concat_0_height)]" }, {"events": {"signal": "brush_scale_trigger"}, "update": "[0, 0]"}, { "events": {"signal": "brush_translate_delta"}, "update": "clampRange(panLinear(brush_translate_anchor.extent_y, brush_translate_delta.y / span(brush_translate_anchor.extent_y)), 0, concat_0_height)" }, { "events": {"signal": "brush_zoom_delta"}, "update": "clampRange(zoomLinear(brush_y, brush_zoom_anchor.y, brush_zoom_delta), 0, concat_0_height)" }, { "events": [{"source": "scope", "type": "dblclick"}], "update": "[0, 0]" } ] }, { "name": "brush_Country", "on": [ { "events": {"signal": "brush_y"}, "update": "brush_y[0] === brush_y[1] ? null : invert(\"concat_0_y\", brush_y)" } ] }, { "name": "brush_scale_trigger", "value": {}, "on": [ { "events": [{"scale": "concat_0_y"}], "update": "(!isArray(brush_Country) || (invert(\"concat_0_y\", brush_y)[0] === brush_Country[0] && invert(\"concat_0_y\", brush_y)[1] === brush_Country[1])) ? brush_scale_trigger : {}" } ] }, { "name": "brush_tuple", "on": [ { "events": [{"signal": "brush_Country"}], "update": "brush_Country ? {unit: \"concat_0\", fields: brush_tuple_fields, values: [brush_Country]} : null" } ] }, { "name": "brush_tuple_fields", "value": [{"field": "Country", "channel": "y", "type": "E"}] }, { "name": "brush_translate_anchor", "value": {}, "on": [ { "events": [ { "source": "scope", "type": "mousedown", "markname": "brush_brush" } ], "update": "{x: x(unit), y: y(unit), extent_y: slice(brush_y)}" } ] }, { "name": "brush_translate_delta", "value": {}, "on": [ { "events": [ { "source": "window", "type": "mousemove", "consume": true, "between": [ { "source": "scope", "type": "mousedown", "markname": "brush_brush" }, {"source": "window", "type": "mouseup"} ] } ], "update": "{x: brush_translate_anchor.x - x(unit), y: brush_translate_anchor.y - y(unit)}" } ] }, { "name": "brush_zoom_anchor", "on": [ { "events": [ { "source": "scope", "type": "wheel", "consume": true, "markname": "brush_brush" } ], "update": "{x: x(unit), y: y(unit)}" } ] }, { "name": "brush_zoom_delta", "on": [ { "events": [ { "source": "scope", "type": "wheel", "consume": true, "markname": "brush_brush" } ], "force": true, "update": "pow(1.001, event.deltaY * pow(16, event.deltaMode))" } ] }, { "name": "brush_modify", "on": [ { "events": {"signal": "brush_tuple"}, "update": "modify(\"brush_store\", brush_tuple, true)" } ] } ], "marks": [ { "name": "brush_brush_bg", "type": "rect", "clip": true, "encode": { "enter": { "fill": {"value": "#333"}, "fillOpacity": {"value": 0.125} }, "update": { "x": [ { "test": "data(\"brush_store\").length && data(\"brush_store\")[0].unit === \"concat_0\"", "value": 0 }, {"value": 0} ], "y": [ { "test": "data(\"brush_store\").length && data(\"brush_store\")[0].unit === \"concat_0\"", "signal": "brush_y[0]" }, {"value": 0} ], "x2": [ { "test": "data(\"brush_store\").length && data(\"brush_store\")[0].unit === \"concat_0\"", "field": {"group": "width"} }, {"value": 0} ], "y2": [ { "test": "data(\"brush_store\").length && data(\"brush_store\")[0].unit === \"concat_0\"", "signal": "brush_y[1]" }, {"value": 0} ] } } }, { "name": "concat_0_marks", "type": "rect", "style": ["bar"], "interactive": true, "from": {"data": "data_1"}, "encode": { "update": { "fill": [ { "test": "!(length(data(\"brush_store\"))) || (!(vlSelectionTest(\"brush_store\", datum)))", "value": "steelblue" }, {"value": "goldenrod"} ], "ariaRoleDescription": {"value": "bar"}, "description": { "signal": "\"Country: \" + (isValid(datum[\"Country\"]) ? datum[\"Country\"] : \"\"+datum[\"Country\"]) + \"; Population_ages_15_64_of_total: \" + (format(datum[\"Population_ages_15_64_of_total\"], \"\"))" }, "x": { "scale": "concat_0_x", "field": "Population_ages_15_64_of_total" }, "x2": {"scale": "concat_0_x", "value": 0}, "y": {"scale": "concat_0_y", "field": "Country"}, "height": {"scale": "concat_0_y", "band": 1} } } }, { "name": "brush_brush", "type": "rect", "clip": true, "encode": { "enter": {"fill": {"value": "transparent"}}, "update": { "x": [ { "test": "data(\"brush_store\").length && data(\"brush_store\")[0].unit === \"concat_0\"", "value": 0 }, {"value": 0} ], "y": [ { "test": "data(\"brush_store\").length && data(\"brush_store\")[0].unit === \"concat_0\"", "signal": "brush_y[0]" }, {"value": 0} ], "x2": [ { "test": "data(\"brush_store\").length && data(\"brush_store\")[0].unit === \"concat_0\"", "field": {"group": "width"} }, {"value": 0} ], "y2": [ { "test": "data(\"brush_store\").length && data(\"brush_store\")[0].unit === \"concat_0\"", "signal": "brush_y[1]" }, {"value": 0} ], "stroke": [ {"test": "brush_y[0] !== brush_y[1]", "value": "white"}, {"value": null} ] } } } ], "axes": [ { "scale": "concat_0_x", "orient": "bottom", "gridScale": "concat_0_y", "grid": true, "tickCount": {"signal": "ceil(concat_0_width/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "concat_0_x", "orient": "bottom", "grid": false, "title": "Population_ages_15_64_of_total", "labelFlush": true, "labelOverlap": true, "tickCount": {"signal": "ceil(concat_0_width/40)"}, "zindex": 0 }, { "scale": "concat_0_y", "orient": "left", "grid": false, "title": "Country", "zindex": 0 } ] }, { "type": "group", "name": "concat_1_group", "style": "cell", "encode": { "update": { "width": {"signal": "concat_1_width"}, "height": {"signal": "concat_1_height"} } }, "signals": [ { "name": "brush_y", "value": [], "on": [ { "events": { "source": "scope", "type": "mousedown", "filter": [ "!event.item || event.item.mark.name !== \"brush_brush\"" ] }, "update": "[y(unit), y(unit)]" }, { "events": { "source": "window", "type": "mousemove", "consume": true, "between": [ { "source": "scope", "type": "mousedown", "filter": [ "!event.item || event.item.mark.name !== \"brush_brush\"" ] }, {"source": "window", "type": "mouseup"} ] }, "update": "[brush_y[0], clamp(y(unit), 0, concat_1_height)]" }, {"events": {"signal": "brush_scale_trigger"}, "update": "[0, 0]"}, { "events": {"signal": "brush_translate_delta"}, "update": "clampRange(panLinear(brush_translate_anchor.extent_y, brush_translate_delta.y / span(brush_translate_anchor.extent_y)), 0, concat_1_height)" }, { "events": {"signal": "brush_zoom_delta"}, "update": "clampRange(zoomLinear(brush_y, brush_zoom_anchor.y, brush_zoom_delta), 0, concat_1_height)" }, { "events": [{"source": "scope", "type": "dblclick"}], "update": "[0, 0]" } ] }, { "name": "brush_Country", "on": [ { "events": {"signal": "brush_y"}, "update": "brush_y[0] === brush_y[1] ? null : invert(\"concat_1_y\", brush_y)" } ] }, { "name": "brush_scale_trigger", "value": {}, "on": [ { "events": [{"scale": "concat_1_y"}], "update": "(!isArray(brush_Country) || (invert(\"concat_1_y\", brush_y)[0] === brush_Country[0] && invert(\"concat_1_y\", brush_y)[1] === brush_Country[1])) ? brush_scale_trigger : {}" } ] }, { "name": "brush_tuple", "on": [ { "events": [{"signal": "brush_Country"}], "update": "brush_Country ? {unit: \"concat_1\", fields: brush_tuple_fields, values: [brush_Country]} : null" } ] }, { "name": "brush_tuple_fields", "value": [{"field": "Country", "channel": "y", "type": "E"}] }, { "name": "brush_translate_anchor", "value": {}, "on": [ { "events": [ { "source": "scope", "type": "mousedown", "markname": "brush_brush" } ], "update": "{x: x(unit), y: y(unit), extent_y: slice(brush_y)}" } ] }, { "name": "brush_translate_delta", "value": {}, "on": [ { "events": [ { "source": "window", "type": "mousemove", "consume": true, "between": [ { "source": "scope", "type": "mousedown", "markname": "brush_brush" }, {"source": "window", "type": "mouseup"} ] } ], "update": "{x: brush_translate_anchor.x - x(unit), y: brush_translate_anchor.y - y(unit)}" } ] }, { "name": "brush_zoom_anchor", "on": [ { "events": [ { "source": "scope", "type": "wheel", "consume": true, "markname": "brush_brush" } ], "update": "{x: x(unit), y: y(unit)}" } ] }, { "name": "brush_zoom_delta", "on": [ { "events": [ { "source": "scope", "type": "wheel", "consume": true, "markname": "brush_brush" } ], "force": true, "update": "pow(1.001, event.deltaY * pow(16, event.deltaMode))" } ] }, { "name": "brush_modify", "on": [ { "events": {"signal": "brush_tuple"}, "update": "modify(\"brush_store\", brush_tuple, true)" } ] } ], "marks": [ { "name": "brush_brush_bg", "type": "rect", "clip": true, "encode": { "enter": { "fill": {"value": "#333"}, "fillOpacity": {"value": 0.125} }, "update": { "x": [ { "test": "data(\"brush_store\").length && data(\"brush_store\")[0].unit === \"concat_1\"", "value": 0 }, {"value": 0} ], "y": [ { "test": "data(\"brush_store\").length && data(\"brush_store\")[0].unit === \"concat_1\"", "signal": "brush_y[0]" }, {"value": 0} ], "x2": [ { "test": "data(\"brush_store\").length && data(\"brush_store\")[0].unit === \"concat_1\"", "field": {"group": "width"} }, {"value": 0} ], "y2": [ { "test": "data(\"brush_store\").length && data(\"brush_store\")[0].unit === \"concat_1\"", "signal": "brush_y[1]" }, {"value": 0} ] } } }, { "name": "concat_1_marks", "type": "rect", "style": ["bar"], "interactive": true, "from": {"data": "data_2"}, "encode": { "update": { "fill": [ { "test": "!(length(data(\"brush_store\"))) || (!(vlSelectionTest(\"brush_store\", datum)))", "value": "steelblue" }, {"value": "goldenrod"} ], "ariaRoleDescription": {"value": "bar"}, "description": { "signal": "\"Country: \" + (isValid(datum[\"Country\"]) ? datum[\"Country\"] : \"\"+datum[\"Country\"]) + \"; Population_ages_65_and_above_of_total: \" + (format(datum[\"Population_ages_65_and_above_of_total\"], \"\"))" }, "x": { "scale": "concat_1_x", "field": "Population_ages_65_and_above_of_total" }, "x2": {"scale": "concat_1_x", "value": 0}, "y": {"scale": "concat_1_y", "field": "Country"}, "height": {"scale": "concat_1_y", "band": 1} } } }, { "name": "brush_brush", "type": "rect", "clip": true, "encode": { "enter": {"fill": {"value": "transparent"}}, "update": { "x": [ { "test": "data(\"brush_store\").length && data(\"brush_store\")[0].unit === \"concat_1\"", "value": 0 }, {"value": 0} ], "y": [ { "test": "data(\"brush_store\").length && data(\"brush_store\")[0].unit === \"concat_1\"", "signal": "brush_y[0]" }, {"value": 0} ], "x2": [ { "test": "data(\"brush_store\").length && data(\"brush_store\")[0].unit === \"concat_1\"", "field": {"group": "width"} }, {"value": 0} ], "y2": [ { "test": "data(\"brush_store\").length && data(\"brush_store\")[0].unit === \"concat_1\"", "signal": "brush_y[1]" }, {"value": 0} ], "stroke": [ {"test": "brush_y[0] !== brush_y[1]", "value": "white"}, {"value": null} ] } } } ], "axes": [ { "scale": "concat_1_x", "orient": "bottom", "gridScale": "concat_1_y", "grid": true, "tickCount": {"signal": "ceil(concat_1_width/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "concat_1_x", "orient": "bottom", "grid": false, "title": "Population_ages_65_and_above_of_total", "labelFlush": true, "labelOverlap": true, "tickCount": {"signal": "ceil(concat_1_width/40)"}, "zindex": 0 }, { "scale": "concat_1_y", "orient": "left", "grid": false, "title": "Country", "zindex": 0 } ] }, { "type": "group", "name": "concat_2_group", "style": "cell", "encode": { "update": { "width": {"signal": "concat_2_width"}, "height": {"signal": "concat_2_height"} } }, "signals": [ { "name": "brush_x", "value": [], "on": [ { "events": { "source": "scope", "type": "mousedown", "filter": [ "!event.item || event.item.mark.name !== \"brush_brush\"" ] }, "update": "[x(unit), x(unit)]" }, { "events": { "source": "window", "type": "mousemove", "consume": true, "between": [ { "source": "scope", "type": "mousedown", "filter": [ "!event.item || event.item.mark.name !== \"brush_brush\"" ] }, {"source": "window", "type": "mouseup"} ] }, "update": "[brush_x[0], clamp(x(unit), 0, concat_2_width)]" }, { "events": {"signal": "brush_scale_trigger"}, "update": "[scale(\"concat_2_x\", brush_Population_ages_65_and_above_of_total[0]), scale(\"concat_2_x\", brush_Population_ages_65_and_above_of_total[1])]" }, { "events": {"signal": "brush_translate_delta"}, "update": "clampRange(panLinear(brush_translate_anchor.extent_x, brush_translate_delta.x / span(brush_translate_anchor.extent_x)), 0, concat_2_width)" }, { "events": {"signal": "brush_zoom_delta"}, "update": "clampRange(zoomLinear(brush_x, brush_zoom_anchor.x, brush_zoom_delta), 0, concat_2_width)" }, { "events": [{"source": "scope", "type": "dblclick"}], "update": "[0, 0]" } ] }, { "name": "brush_Population_ages_65_and_above_of_total", "on": [ { "events": {"signal": "brush_x"}, "update": "brush_x[0] === brush_x[1] ? null : invert(\"concat_2_x\", brush_x)" } ] }, { "name": "brush_y", "value": [], "on": [ { "events": { "source": "scope", "type": "mousedown", "filter": [ "!event.item || event.item.mark.name !== \"brush_brush\"" ] }, "update": "[y(unit), y(unit)]" }, { "events": { "source": "window", "type": "mousemove", "consume": true, "between": [ { "source": "scope", "type": "mousedown", "filter": [ "!event.item || event.item.mark.name !== \"brush_brush\"" ] }, {"source": "window", "type": "mouseup"} ] }, "update": "[brush_y[0], clamp(y(unit), 0, concat_2_height)]" }, { "events": {"signal": "brush_scale_trigger"}, "update": "[scale(\"concat_2_y\", brush_Population_ages_15_64_of_total[0]), scale(\"concat_2_y\", brush_Population_ages_15_64_of_total[1])]" }, { "events": {"signal": "brush_translate_delta"}, "update": "clampRange(panLinear(brush_translate_anchor.extent_y, brush_translate_delta.y / span(brush_translate_anchor.extent_y)), 0, concat_2_height)" }, { "events": {"signal": "brush_zoom_delta"}, "update": "clampRange(zoomLinear(brush_y, brush_zoom_anchor.y, brush_zoom_delta), 0, concat_2_height)" }, { "events": [{"source": "scope", "type": "dblclick"}], "update": "[0, 0]" } ] }, { "name": "brush_Population_ages_15_64_of_total", "on": [ { "events": {"signal": "brush_y"}, "update": "brush_y[0] === brush_y[1] ? null : invert(\"concat_2_y\", brush_y)" } ] }, { "name": "brush_scale_trigger", "value": {}, "on": [ { "events": [{"scale": "concat_2_x"}, {"scale": "concat_2_y"}], "update": "(!isArray(brush_Population_ages_65_and_above_of_total) || (+invert(\"concat_2_x\", brush_x)[0] === +brush_Population_ages_65_and_above_of_total[0] && +invert(\"concat_2_x\", brush_x)[1] === +brush_Population_ages_65_and_above_of_total[1])) && (!isArray(brush_Population_ages_15_64_of_total) || (+invert(\"concat_2_y\", brush_y)[0] === +brush_Population_ages_15_64_of_total[0] && +invert(\"concat_2_y\", brush_y)[1] === +brush_Population_ages_15_64_of_total[1])) ? brush_scale_trigger : {}" } ] }, { "name": "brush_tuple", "on": [ { "events": [ { "signal": "brush_Population_ages_65_and_above_of_total || brush_Population_ages_15_64_of_total" } ], "update": "brush_Population_ages_65_and_above_of_total && brush_Population_ages_15_64_of_total ? {unit: \"concat_2\", fields: brush_tuple_fields, values: [brush_Population_ages_65_and_above_of_total,brush_Population_ages_15_64_of_total]} : null" } ] }, { "name": "brush_tuple_fields", "value": [ { "field": "Population_ages_65_and_above_of_total", "channel": "x", "type": "R" }, { "field": "Population_ages_15_64_of_total", "channel": "y", "type": "R" } ] }, { "name": "brush_translate_anchor", "value": {}, "on": [ { "events": [ { "source": "scope", "type": "mousedown", "markname": "brush_brush" } ], "update": "{x: x(unit), y: y(unit), extent_x: slice(brush_x), extent_y: slice(brush_y)}" } ] }, { "name": "brush_translate_delta", "value": {}, "on": [ { "events": [ { "source": "window", "type": "mousemove", "consume": true, "between": [ { "source": "scope", "type": "mousedown", "markname": "brush_brush" }, {"source": "window", "type": "mouseup"} ] } ], "update": "{x: brush_translate_anchor.x - x(unit), y: brush_translate_anchor.y - y(unit)}" } ] }, { "name": "brush_zoom_anchor", "on": [ { "events": [ { "source": "scope", "type": "wheel", "consume": true, "markname": "brush_brush" } ], "update": "{x: x(unit), y: y(unit)}" } ] }, { "name": "brush_zoom_delta", "on": [ { "events": [ { "source": "scope", "type": "wheel", "consume": true, "markname": "brush_brush" } ], "force": true, "update": "pow(1.001, event.deltaY * pow(16, event.deltaMode))" } ] }, { "name": "brush_modify", "on": [ { "events": {"signal": "brush_tuple"}, "update": "modify(\"brush_store\", brush_tuple, true)" } ] } ], "marks": [ { "name": "brush_brush_bg", "type": "rect", "clip": true, "encode": { "enter": { "fill": {"value": "#333"}, "fillOpacity": {"value": 0.125} }, "update": { "x": [ { "test": "data(\"brush_store\").length && data(\"brush_store\")[0].unit === \"concat_2\"", "signal": "brush_x[0]" }, {"value": 0} ], "y": [ { "test": "data(\"brush_store\").length && data(\"brush_store\")[0].unit === \"concat_2\"", "signal": "brush_y[0]" }, {"value": 0} ], "x2": [ { "test": "data(\"brush_store\").length && data(\"brush_store\")[0].unit === \"concat_2\"", "signal": "brush_x[1]" }, {"value": 0} ], "y2": [ { "test": "data(\"brush_store\").length && data(\"brush_store\")[0].unit === \"concat_2\"", "signal": "brush_y[1]" }, {"value": 0} ] } } }, { "name": "concat_2_marks", "type": "symbol", "style": ["point"], "interactive": true, "from": {"data": "data_3"}, "encode": { "update": { "opacity": {"value": 0.7}, "fill": {"value": "transparent"}, "stroke": [ { "test": "!(length(data(\"brush_store\"))) || (!(vlSelectionTest(\"brush_store\", datum)))", "value": "steelblue" }, {"value": "goldenrod"} ], "ariaRoleDescription": {"value": "point"}, "description": { "signal": "\"Population_ages_15_64_of_total: \" + (format(datum[\"Population_ages_15_64_of_total\"], \"\")) + \"; Population_ages_65_and_above_of_total: \" + (format(datum[\"Population_ages_65_and_above_of_total\"], \"\"))" }, "x": [ { "test": "!isValid(datum[\"Population_ages_65_and_above_of_total\"]) || !isFinite(+datum[\"Population_ages_65_and_above_of_total\"])", "value": 0 }, { "scale": "concat_2_x", "field": "Population_ages_65_and_above_of_total" } ], "y": [ { "test": "!isValid(datum[\"Population_ages_15_64_of_total\"]) || !isFinite(+datum[\"Population_ages_15_64_of_total\"])", "field": {"group": "height"} }, { "scale": "concat_2_y", "field": "Population_ages_15_64_of_total" } ] } } }, { "name": "brush_brush", "type": "rect", "clip": true, "encode": { "enter": {"fill": {"value": "transparent"}}, "update": { "x": [ { "test": "data(\"brush_store\").length && data(\"brush_store\")[0].unit === \"concat_2\"", "signal": "brush_x[0]" }, {"value": 0} ], "y": [ { "test": "data(\"brush_store\").length && data(\"brush_store\")[0].unit === \"concat_2\"", "signal": "brush_y[0]" }, {"value": 0} ], "x2": [ { "test": "data(\"brush_store\").length && data(\"brush_store\")[0].unit === \"concat_2\"", "signal": "brush_x[1]" }, {"value": 0} ], "y2": [ { "test": "data(\"brush_store\").length && data(\"brush_store\")[0].unit === \"concat_2\"", "signal": "brush_y[1]" }, {"value": 0} ], "stroke": [ { "test": "brush_x[0] !== brush_x[1] && brush_y[0] !== brush_y[1]", "value": "white" }, {"value": null} ] } } } ], "axes": [ { "scale": "concat_2_x", "orient": "bottom", "gridScale": "concat_2_y", "grid": true, "tickCount": {"signal": "ceil(concat_2_width/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "concat_2_y", "orient": "left", "gridScale": "concat_2_x", "grid": true, "tickCount": {"signal": "ceil(concat_2_height/40)"}, "domain": false, "labels": false, "aria": false, "maxExtent": 0, "minExtent": 0, "ticks": false, "zindex": 0 }, { "scale": "concat_2_x", "orient": "bottom", "grid": false, "title": "Population_ages_65_and_above_of_total", "labelFlush": true, "labelOverlap": true, "tickCount": {"signal": "ceil(concat_2_width/40)"}, "zindex": 0 }, { "scale": "concat_2_y", "orient": "left", "grid": false, "title": "Population_ages_15_64_of_total", "labelOverlap": true, "tickCount": {"signal": "ceil(concat_2_height/40)"}, "zindex": 0 } ] } ], "scales": [ { "name": "concat_0_x", "type": "linear", "domain": {"data": "data_1", "field": "Population_ages_15_64_of_total"}, "range": [0, {"signal": "concat_0_width"}], "nice": true, "zero": true }, { "name": "concat_0_y", "type": "band", "domain": { "data": "source_0", "field": "Country", "sort": { "op": "min", "field": "Population_ages_15_64_of_total", "order": "descending" } }, "range": [0, {"signal": "concat_0_height"}], "paddingInner": 0.1, "paddingOuter": 0.05 }, { "name": "concat_1_x", "type": "linear", "domain": { "data": "data_2", "field": "Population_ages_65_and_above_of_total" }, "range": [0, {"signal": "concat_1_width"}], "nice": true, "zero": true }, { "name": "concat_1_y", "type": "band", "domain": { "data": "source_0", "field": "Country", "sort": { "op": "min", "field": "Population_ages_65_and_above_of_total", "order": "descending" } }, "range": [0, {"signal": "concat_1_height"}], "paddingInner": 0.1, "paddingOuter": 0.05 }, { "name": "concat_2_x", "type": "linear", "domain": { "data": "data_3", "field": "Population_ages_65_and_above_of_total" }, "range": [0, {"signal": "concat_2_width"}], "zero": false, "nice": true }, { "name": "concat_2_y", "type": "linear", "domain": {"data": "data_3", "field": "Population_ages_15_64_of_total"}, "range": [{"signal": "concat_2_height"}, 0], "zero": false, "nice": true } ]}