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

Материал из wiki.energogroup.org
Перейти к навигации Перейти к поиску
 
(не показано 35 промежуточных версий этого же участника)
Строка 1: Строка 1:
  +
<graph>
  +
  +
"version": 2,
  +
"width": 1,
  +
"height": 1,
  +
"data": [
  +
"values": [
  +
{"a": "C", "b": 2}, {"a": "C", "b": 7}, {"a": "C", "b": 4},
  +
{"a": "D", "b": 1}, {"a": "D", "b": 2}, {"a": "D", "b": 6},
  +
{"a": "E", "b": 8}, {"a": "E", "b": 4}, {"a": "E", "b": 7}
  +
]
  +
},
  +
"mark": "point",
  +
"encoding": {
  +
"x": {"field": "a", "type": "nominal"},
  +
"y": {"field": "b", "type": "quantitative"}
  +
]
  +
</graph>
  +
<graph>
  +
{
  +
"version": 2,
  +
"width": 1,
  +
"height": 1,
  +
"data": [
  +
{
  +
"name": "highlights",
  +
"values": [{"id":"US","v":"blue"},{"id":"AU","v":"purple"},{"id":"CN","v":"red"},{"id":"BR","v":"pink"},{"id":"DZ","v":"green"}]
  +
},
  +
{
  +
"name": "countries",
  +
"url": "wikiraw:///Extension:Graph/Demo/RawData:WorldMap-iso2-json",
  +
"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": [
  +
{
  +
"type": "path",
  +
"from": {
  +
"data": "countries"
  +
},
  +
"properties": {
  +
"enter": {
  +
"path": {
  +
"field": "layout_path"
  +
}
  +
},
  +
"update": {
  +
"fill": {
  +
"field": "zipped.v"
  +
}
  +
},
  +
"hover": {
  +
"fill": {
  +
"value": "#989898"
  +
}
  +
}
  +
}
  +
}
  +
]
  +
}
  +
  +
</graph>
  +
 
<graph>
 
<graph>
 
{
 
{
 
"version": 2,
 
"version": 2,
"width": 600,
+
"width": 100,
"height": 600,
+
"height": 100,
"padding": 5,
+
"data": [
  +
{
"signals": [
 
{ "name": "rotation", "init": 0,
+
"name": "table",
"streams": [{
+
"values": [12,23,47,6,52,19],
"type": "click",
+
"transform": [{"type": "pie","field": "data"}]
"expr": "rotation + 6.14/180"
 
}]
 
 
}
 
}
 
],
 
],
"data": [
+
"scales": [
 
{
 
{
"name": "tree",
+
"name": "r",
"url": "wikiraw:///Extension:Graph/data/flare-json",
+
"type": "sqrt",
"format": {"type": "treejson"},
+
"domain": {"data": "table","field": "data"},
"transform": [
+
"range": [20,100]
{ "type": "hierarchy", "sort": "name", "size": [6.28, 300], "orient": "radial", "output": {"x": "angle1", "y": "radius"} },
 
{ "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": "formula", "field": "yy", "expr": "300 + datum.radius * cos(datum.angle)" },
 
{ "type": "formula", "field": "xx", "expr": "300 + datum.radius * -sin(datum.angle)" },
 
{ "type": "formula", "field": "align", "expr": "!datum.radius ? 'center' : datum.sign < 0 ? 'left' : 'right'" }
 
]
 
 
}
 
}
 
],
 
],
 
"marks": [
 
"marks": [
 
{
 
{
"type": "path",
+
"type": "arc",
"from": {
+
"from": {"data": "table"},
"data": "tree",
 
"transform": [
 
{"type": "filter", "test": "datum.parent"},
 
{
 
"type": "linkpath",
 
"sourceX": "parent.xx", "sourceY": "parent.yy",
 
"targetX": "xx", "targetY": "yy",
 
"shape": "line"
 
}
 
]
 
},
 
 
"properties": {
 
"properties": {
"update": {
+
"enter": {
"path": {"field": "layout_path"},
+
"x": {"field": {"group": "width"},"mult": 0.5},
"stroke": {"value": "#ddd"}
+
"y": {"field": {"group": "height"},"mult": 0.5},
  +
"startAngle": {"field": "layout_start"},
}
 
  +
"endAngle": {"field": "layout_end"},
  +
"innerRadius": {"value": 20},
  +
"outerRadius": {"scale": "r","field": "data"},
  +
"stroke": {"value": "#fff"}
  +
},
  +
"update": {"fill": {"value": "#ccc"} },
  +
"hover": {"fill": {"value": "pink"} }
 
}
 
}
 
},
 
},
 
{
 
{
 
"type": "text",
 
"type": "text",
"from": {"data": "tree"},
+
"from": {"data": "table"},
 
"properties": {
 
"properties": {
"update": {
+
"enter": {
"x": {"field": "xx"},
+
"x": {"field": {"group": "width"},"mult": 0.5},
"y": {"field": "yy"},
+
"y": {"field": {"group": "height"},"mult": 0.5},
"font": {"value": "Helvetica Neue"},
+
"radius": {"scale": "r","field": "data","offset": 8},
"fontSize": {"value": 10},
+
"theta": {"field": "layout_mid"},
"align": {"field": "align"},
 
"baseline": {"value": "middle"},
 
 
"fill": {"value": "#000"},
 
"fill": {"value": "#000"},
"text": {"field": "name"},
+
"align": {"value": "center"},
"angle": {"field": "degrees"}
+
"baseline": {"value": "middle"},
  +
"text": {"field": "data"}
 
}
 
}
 
}
 
}

Текущая версия от 17:24, 7 ноября 2022

Синтаксическая ошибка