User:Yair rand/Wiki readership map

{ "version": 2, "width": 1250, "height": 670, "padding": 12, "background": "#edf1f7", "data": [ {     "name": "map", "url": "wikiraw:///Extension:Graph/Demo/RawData:WorldMap-iso2-json", "format": {"type": "topojson","feature": "countries"}, "transform": [ {         "type": "geopath", "value": "data", "scale": 180, "center": [-180,125], "translate": [0,0], "projection": "equirectangular" }     ]    },    {      "name": "spu", "url": "tabular:///Pageviews-by-country-monthly-2020-01.tab", "format":{ "":"wiki_db,country,count", "type":"json","property":"data" },     "transform":[ {     		"type":"filter", "test":"true||!(test(/wiki$/,datum.wiki_db) && indexof(['commonswiki','metawiki','mediawikiwiki','wikidatawiki'],datum.wiki_db) == -1)" }     ]    },    {      "name": "spup", "source":"spu", "transform": [ {         "type": "aggregate", "groupby": ["wiki_db"], "summarize":{"count":"sum"} },       {        	"type":"sort", "by":["-sum_count"] }     ]    },    {      "name": "spug", "source":"spu", "transform": [ {         "type": "aggregate", "groupby": ["country"], "summarize":{"count":"sum"} }     ]    },    {      "name": "spuzz", "source":"spu", "transform": [ {       	"type":"lookup", "on":"spup", "onKey":"wiki_db", "keys":["wiki_db"], "as":["db_count"] },       {        	"":"wiki_db,country,count", "type": "facet", "groupby": ["country"], "transform":[ {	       	"type":"sort", "by":"-db_count.sum_count" },         	{"type":"pie","field":"count"} ]       }      ]    },    {      "name":"bo", "url":"wikidatasparql:///?query=SELECT%20%3Fcode%20%3Fcoords%20WHERE%20%7B%0A%20%20%3Fq%20wdt%3AP297%20%3Fcode%3B%0A%20%20%20%20%20wdt%3AP625%20%3Fcoords%20.%0A%7D", "transform": [ {         "type": "geo", "projection": "equirectangular", "scale": 180, "center": [-180,125], "translate": [0,0], "lon": "coords[0]", "lat": "coords[1]" }     ]    },    {    	"name":"mo", "source":"spuzz", "transform":[ {	       	"type":"lookup", "on":"bo", "onKey":"code", "keys":["country"], "as":["objq"] },	       {	        	"type":"lookup", "on":"spug", "onKey":"country", "keys":["country"], "as":["big"] },	       {	        	"type":"filter", "test":"datum.objq" },	       {	        	"type":"sort", "by":"-big.sum_count" }		]   }  ],

"signals": [ {     "name": "tooltip", "init": {"W":4}, "streams": [ {         "type": "arc:mouseover", "expr": "{'count':format(',',datum.count),wiki_db:datum.wiki_db,tc:format('.1%',datum.count/parent.big.sum_count),'pp':format('.1%',datum.count/datum.db_count.sum_count),'country':datum.country}" },       {          "type": "legend:mouseover", "expr": "{'wiki_db':datum}" },       {"type": "arc:mouseout", "expr": "{}"} ]   }  ],  "scales":[ {     "name": "color", "type": "ordinal", "_domain": {"data": "spu", "field": "wiki_db"}, "domain": [ "enwiki","dewiki","frwiki","jawiki","ruwiki","eswiki","ptwiki","arwiki", "itwiki","zhwiki","nlwiki","hewiki","plwiki","idwiki","fawiki","trwiki", "kowiki","thwiki","viwiki","commonswiki" ], 	  "__domain": {"data": "spup", "field": "wiki_db"}, "sort":{"field":"wiki_db"}, "range": "category20", "_range":["orange","blue","red","green"] },   {      "name": "psize", "type": "sqrt", "_domain": {"data": "spug", "field": "sum_count"}, "domain": [0,4000000], "range": [0,50] } ],  "legends": [{ "name":"lg", "fill": "color", "title":"Wikis", "properties": { "symbols": { "strokeWidth": {"value": 0}, "shape": {"value": "square"}, "opacity": {"value": 1} },     "legend": { "x": {"value": 10}, "y": {"value": 5}, "fill": {"value": "white"} }   }  }],  "marks": [ {     "name": "map", "type": "path", "from": {"data": "map"}, "properties": { "enter": { "fill": {"value": "grey"}, "path": {"field": "layout_path"} }     }    },    {      "name": "circle5", "type": "group", "from": { "data": "mo" },     "properties": { "enter": { "x": {"field": "objq.layout_x"}, "y": {"field": "objq.layout_y"} }     },      "marks":[ {	     "type": "text", "properties": { "enter": { "__text": {"field":{"parent":"code"}}, "text": {"field":"wiki_db"}, "_text": {"value":"O"}, "fill":{"value":"transparent"} }	     }	    },	    {	      "type": "arc", "properties": { "enter": { "startAngle": {"field": "layout_start"}, "endAngle": {"field": "layout_end"}, "_outerRadius": {"value": 15}, "outerRadius": {"field": {"parent":"big.sum_count"},"scale":"psize"}, "stroke": {"value": "#fff"}, "fill": {"field": "wiki_db","scale":"color"} },	       "hover":{ "strokeWidth":{"value":1} },	       "update":{ "strokeWidth":{"value":0.1}, "opacity": [ { "test": "tooltip.wiki_db && tooltip.wiki_db != datum.wiki_db", "value": 0.25 },	           {"value": 1} ]	       }	      }	    }      ]    },    {    	"type":"text", "properties":{ "update":{ "_text":{"value":"ta"}, "text": {"template": "\u007b{tooltip.wiki_db}}: \u007b{tooltip.count}},000 views, \u007b{tooltip.tc}} of country (\u007b{tooltip.country}}), \u007b{tooltip.pp}} of \u007b{tooltip.wiki_db}}"}, "fill":{"value":"black"}, "x":{"value":135}, "y":{"value":125}, "opacity": [ { "test": "!tooltip.wiki_db", "value": 0 },		         {"value": 1} ]   		}    	}    }  ] }