Карта мира: различия между версиями
Перейти к навигации
Перейти к поиску
Метка: визуальный редактор отключён |
Метка: визуальный редактор отключён |
||
Строка 1: | Строка 1: | ||
<graph> |
<graph> |
||
{ |
{ |
||
− | + | "version": 2, |
|
− | + | "width": 600, |
|
− | + | "height": 600, |
|
− | + | "padding": 5, |
|
+ | "signals": [ |
||
⚫ | |||
− | + | { "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" |
|
+ | }] |
||
⚫ | |||
+ | } |
||
− | "url": "wikiraw:///Extension:Graph/Demo/RawData:WorldMap-iso2-json", |
||
+ | ], |
||
⚫ | |||
− | + | "data": [ |
|
− | + | { |
|
− | + | "name": "tree", |
|
− | + | "url": "wikiraw:///Extension:Graph/data/flare-json", |
|
− | + | "format": {"type": "treejson"}, |
|
− | + | "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": "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'" } |
||
⚫ | |||
+ | ] |
||
− | "as": [ "zipped" ], |
||
+ | } |
||
⚫ | |||
+ | ], |
||
− | "v": "#C0C0C0" |
||
+ | "marks": [ |
||
− | } |
||
− | + | { |
|
− | + | "type": "path", |
|
+ | "from": { |
||
+ | "data": "tree", |
||
+ | "transform": [ |
||
⚫ | |||
⚫ | |||
⚫ | |||
+ | "sourceX": "parent.xx", "sourceY": "parent.yy", |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
+ | "properties": { |
||
⚫ | |||
+ | "path": {"field": "layout_path"}, |
||
⚫ | |||
} |
} |
||
− | + | } |
|
− | + | }, |
|
− | + | { |
|
− | + | "type": "text", |
|
− | + | "from": {"data": "tree"}, |
|
− | + | "properties": { |
|
− | + | "update": { |
|
− | + | "x": {"field": "xx"}, |
|
− | + | "y": {"field": "yy"}, |
|
− | + | "font": {"value": "Helvetica Neue"}, |
|
− | + | "fontSize": {"value": 10}, |
|
− | + | "align": {"field": "align"}, |
|
− | + | "baseline": {"value": "middle"}, |
|
− | + | "fill": {"value": "#000"}, |
|
− | + | "text": {"field": "name"}, |
|
− | + | "angle": {"field": "degrees"} |
|
− | } |
||
− | }, |
||
⚫ | |||
− | "fill": { |
||
⚫ | |||
− | } |
||
− | } |
||
⚫ | |||
} |
} |
||
− | + | } |
|
+ | } |
||
+ | ] |
||
} |
} |
||
</graph> |
</graph> |