Карта мира: различия между версиями

Материал из wiki.energogroup.org
Перейти к навигации Перейти к поиску
Строка 1: Строка 1:
 
<graph>
 
<graph>
 
{
 
{
"version": 2,
+
"version": 2,
"width": 200,
+
"width": 1,
"height": 250,
+
"height": 1,
"padding": 12,
+
"data": [
"data": [
 
{
 
"name": "points",
 
"url": "wikidatasparql:///?query={{{query}}}",
 
"format": {
 
"type": "json"
 
},
 
"transform": [
 
 
{
 
{
"type": "geo",
+
"name": "highlights",
  +
"values": [{"id":"US","v":"blue"},{"id":"AU","v":"purple"},{"id":"CN","v":"red"},{"id":"BR","v":"pink"},{"id":"DZ","v":"green"}]
"projection": "mercator",
 
"scale": 450,
+
},
"center": [5,70],
+
{
"translate": [0,0],
+
"name": "countries",
"lon": "gps[0]",
+
"url": "wikiraw:///Extension:Graph/Demo/RawData:WorldMap-iso2-json",
"lat": "gps[1]"
+
"format": {"type": "topojson", "feature": "countries"},
 
"transform": [
 
{
  +
"type": "geopath",
 
"value": "data",
  +
"scale": 80,
  +
"translate":[0,0],
 
"projection": "equirectangular"
 
},
 
{
 
"type": "lookup",
  +
"keys": [ "id" ],
  +
"on": "highlights",
  +
"onKey": "id",
  +
"as": [ "zipped" ],
 
"default": {
  +
"v": "#C0C0C0"
  +
}
 
}
 
]
 
}
 
}
]
+
],
},
+
"marks": [
{
 
"name": "countries",
 
"url": "wikiraw://www.mediawiki.org/Extension:Graph/Demo/RawData:WorldMap-iso2-json",
 
"format": {"type": "topojson","feature": "countries"},
 
"transform": [
 
 
{
 
{
"type": "geopath",
+
"type": "path",
"value": "data",
+
"from": {
"scale": 450,
+
"data": "countries"
"center": [5,70],
+
},
"translate": [0,0],
+
"properties": {
"projection": "mercator"
+
"enter": {
}
+
"path": {
 
"field": "layout_path"
]
 
}
+
}
  +
},
],
 
"scales": [
+
"update": {
  +
"fill": {
{
 
"name": "size",
+
"field": "zipped.v"
"type": "linear",
+
}
"domain": {"data": "points", "field": "size"},
+
},
"range": [5, 5]
+
"hover": {
  +
"fill": {
},
 
  +
"value": "#989898"
{
 
"name": "fill",
+
}
"type": "ordinal",
+
}
"domain": {"data": "points", "field": "fill"},
+
}
"range": "category20"
 
},
 
],
 
"marks": [
 
{
 
"name": "map",
 
"type": "path",
 
"from": {"data": "countries"},
 
"properties": {
 
"enter": {
 
"fill": {"value": "silver"},
 
"stroke": {"value":"black" },
 
"path": {"field": "layout_path"}
 
}
 
}
 
},
 
{
 
"name": "circle",
 
"type": "symbol",
 
"from": {"data": "points"},
 
"properties": {
 
"enter": {
 
"size": {"scale": "size", "value": "5"},
 
"fill": {"scale": "fill", "field": "fill" },
 
"fillOpacity": {"value": 1},
 
"stroke": {"scale": "fill", "field": "fill" },
 
"strokeWidth": {"value": 1},
 
"x": {"field": "layout_x"},
 
"y": {"field": "layout_y"}
 
 
}
 
}
}
+
]
}
 
]
 
 
}
 
}
 
</graph>
 
</graph>

Версия от 12:12, 3 ноября 2022