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

Материал из wiki.energogroup.org
Перейти к навигации Перейти к поиску
Строка 1: Строка 1:
 
<graph>
 
<graph>
 
{
 
{
"version": 2,
+
"version": 2,
"width": 1,
+
"width": 600,
"height": 1,
+
"height": 600,
"data": [
+
"padding": 5,
  +
"signals": [
{
 
"name": "highlights",
+
{ "name": "rotation", "init": 0,
  +
"streams": [{
"values": [{"id":"US","v":"blue"},{"id":"AU","v":"purple"},{"id":"CN","v":"red"},{"id":"BR","v":"pink"},{"id":"DZ","v":"green"}]
 
},
+
"type": "click",
{
+
"expr": "rotation + 6.14/180"
  +
}]
"name": "countries",
 
  +
}
"url": "wikiraw:///Extension:Graph/Demo/RawData:WorldMap-iso2-json",
 
  +
],
"format": {"type": "topojson", "feature": "countries"},
 
"transform": [
+
"data": [
{
+
{
"type": "geopath",
+
"name": "tree",
"value": "data",
+
"url": "wikiraw:///Extension:Graph/data/flare-json",
"scale": 80,
+
"format": {"type": "treejson"},
"translate":[0,0],
+
"transform": [
  +
{ "type": "hierarchy", "sort": "name", "size": [6.28, 300], "orient": "radial", "output": {"x": "angle1", "y": "radius"} },
"projection": "equirectangular"
 
  +
{ "type": "formula", "field": "angle", "expr": "(datum.angle1 + rotation) % (2*PI)" },
},
 
  +
{ "type": "formula", "field": "sign", "expr": "datum.angle > 3.14 ? 1 : -1" },
{
 
  +
{ "type": "formula", "field": "degrees", "expr": "!datum.radius ? 0 : (datum.angle + datum.sign*1.57) * 180/PI" },
"type": "lookup",
 
"keys": [ "id" ],
+
{ "type": "formula", "field": "yy", "expr": "300 + datum.radius * cos(datum.angle)" },
"on": "highlights",
+
{ "type": "formula", "field": "xx", "expr": "300 + datum.radius * -sin(datum.angle)" },
  +
{ "type": "formula", "field": "align", "expr": "!datum.radius ? 'center' : datum.sign < 0 ? 'left' : 'right'" }
"onKey": "id",
 
  +
]
"as": [ "zipped" ],
 
  +
}
"default": {
 
  +
],
"v": "#C0C0C0"
 
  +
"marks": [
}
 
}
+
{
]
+
"type": "path",
  +
"from": {
  +
"data": "tree",
  +
"transform": [
 
{"type": "filter", "test": "datum.parent"},
 
{
 
"type": "linkpath",
  +
"sourceX": "parent.xx", "sourceY": "parent.yy",
 
"targetX": "xx", "targetY": "yy",
 
"shape": "line"
 
}
 
]
 
},
  +
"properties": {
 
"update": {
  +
"path": {"field": "layout_path"},
 
"stroke": {"value": "#ddd"}
 
}
 
}
],
+
}
"marks": [
+
},
{
+
{
"type": "path",
+
"type": "text",
"from": {
+
"from": {"data": "tree"},
"data": "countries"
+
"properties": {
},
+
"update": {
"properties": {
+
"x": {"field": "xx"},
"enter": {
+
"y": {"field": "yy"},
"path": {
+
"font": {"value": "Helvetica Neue"},
"field": "layout_path"
+
"fontSize": {"value": 10},
}
+
"align": {"field": "align"},
},
+
"baseline": {"value": "middle"},
"update": {
+
"fill": {"value": "#000"},
"fill": {
+
"text": {"field": "name"},
"field": "zipped.v"
+
"angle": {"field": "degrees"}
}
 
},
 
"hover": {
 
"fill": {
 
"value": "#989898"
 
}
 
}
 
}
 
 
}
 
}
]
+
}
  +
}
  +
]
 
}
 
}
 
</graph>
 
</graph>

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