Карта мира: различия между версиями
Перейти к навигации
Перейти к поиску
Метка: визуальный редактор отключён |
|||
Строка 1: | Строка 1: | ||
− | <graph> |
||
{ |
{ |
||
− | "version": 2, |
+ | "version": 2, |
− | "width": |
+ | "width": 1, |
− | "height": |
+ | "height": 1, |
− | " |
+ | "data": [ |
⚫ | |||
− | "signals": [ |
||
− | + | "name": "highlights", |
|
+ | "values": [{"id":"US","v":"blue"},{"id":"AU","v":"purple"},{"id":"CN","v":"red"},{"id":"BR","v":"pink"},{"id":"DZ","v":"green"}] |
||
− | "streams": [{ |
||
− | + | }, |
|
− | + | { |
|
⚫ | |||
− | }] |
||
+ | "url": "wikiraw:///Extension:Graph/Demo/RawData:WorldMap-iso2-json", |
||
− | } |
||
⚫ | |||
− | ], |
||
− | " |
+ | "transform": [ |
− | { |
+ | { |
− | " |
+ | "type": "geopath", |
− | " |
+ | "value": "data", |
− | + | "scale": 80, |
|
− | " |
+ | "translate":[0,0], |
+ | "projection": "equirectangular" |
||
− | { "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" }, |
||
− | + | "keys": [ "id" ], |
|
− | + | "on": "highlights", |
|
⚫ | |||
− | { "type": "formula", "field": "align", "expr": "!datum.radius ? 'center' : datum.sign < 0 ? 'left' : 'right'" } |
||
+ | "as": [ "zipped" ], |
||
− | ] |
||
⚫ | |||
− | } |
||
+ | "v": "#C0C0C0" |
||
− | ], |
||
+ | } |
||
− | "marks": [ |
||
− | + | } |
|
− | + | ] |
|
− | "from": { |
||
− | "data": "tree", |
||
− | "transform": [ |
||
⚫ | |||
⚫ | |||
⚫ | |||
− | "sourceX": "parent.xx", "sourceY": "parent.yy", |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
− | "properties": { |
||
⚫ | |||
− | "path": {"field": "layout_path"}, |
||
⚫ | |||
} |
} |
||
− | + | ], |
|
− | + | "marks": [ |
|
− | { |
+ | { |
− | "type": " |
+ | "type": "path", |
− | "from": { |
+ | "from": { |
− | " |
+ | "data": "countries" |
− | + | }, |
|
− | " |
+ | "properties": { |
− | + | "enter": { |
|
− | + | "path": { |
|
− | " |
+ | "field": "layout_path" |
− | + | } |
|
− | + | }, |
|
− | + | "update": { |
|
− | + | "fill": { |
|
− | + | "field": "zipped.v" |
|
+ | } |
||
+ | }, |
||
⚫ | |||
+ | "fill": { |
||
⚫ | |||
+ | } |
||
+ | } |
||
⚫ | |||
} |
} |
||
− | + | ] |
|
− | } |
||
− | ] |
||
} |
} |
||
− | </graph> |
Версия от 12:35, 3 ноября 2022
{
"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" } } } } ]
}