Карта мира: различия между версиями
Перейти к навигации
Перейти к поиску
Метка: визуальный редактор отключён |
|||
Строка 1: | Строка 1: | ||
− | <graph> |
||
{ |
{ |
||
⚫ | |||
− | "$schema": "https://vega.github.io/schema/vega/v5.json", |
||
⚫ | |||
− | "description": "A basic bar chart example, with value labels shown upon mouse hover.", |
||
− | " |
+ | "height": 1, |
− | " |
+ | "data": [ |
⚫ | |||
− | "padding": 5, |
||
⚫ | |||
− | |||
+ | "values": [{"id":"US","v":"blue"},{"id":"AU","v":"purple"},{"id":"CN","v":"red"},{"id":"BR","v":"pink"},{"id":"DZ","v":"green"}] |
||
− | "data": [ |
||
− | { |
||
⚫ | |||
− | "values": [ |
||
− | {"category": "A", "amount": 28}, |
||
− | {"category": "B", "amount": 55}, |
||
− | {"category": "C", "amount": 43}, |
||
− | {"category": "D", "amount": 91}, |
||
− | {"category": "E", "amount": 81}, |
||
− | {"category": "F", "amount": 53}, |
||
− | {"category": "G", "amount": 19}, |
||
− | {"category": "H", "amount": 87} |
||
− | ] |
||
− | } |
||
− | ], |
||
− | |||
− | "signals": [ |
||
− | { |
||
− | "name": "tooltip", |
||
⚫ | |||
⚫ | |||
− | {"events": "rect:mouseover", "update": "datum"}, |
||
− | {"events": "rect:mouseout", "update": "{}"} |
||
− | ] |
||
− | } |
||
− | ], |
||
− | |||
− | "scales": [ |
||
− | { |
||
− | "name": "xscale", |
||
⚫ | |||
⚫ | |||
− | "range": "width", |
||
− | "padding": 0.05, |
||
− | "round": true |
||
− | }, |
||
− | { |
||
− | "name": "yscale", |
||
− | "domain": {"data": "table", "field": "amount"}, |
||
− | "nice": true, |
||
− | "range": "height" |
||
− | } |
||
− | ], |
||
− | |||
− | "axes": [ |
||
− | { "orient": "bottom", "scale": "xscale" }, |
||
− | { "orient": "left", "scale": "yscale" } |
||
− | ], |
||
− | |||
− | "marks": [ |
||
− | { |
||
⚫ | |||
− | "from": {"data":"table"}, |
||
− | "encode": { |
||
⚫ | |||
− | "x": {"scale": "xscale", "field": "category"}, |
||
− | "width": {"scale": "xscale", "band": 1}, |
||
− | "y": {"scale": "yscale", "field": "amount"}, |
||
⚫ | |||
}, |
}, |
||
− | + | { |
|
− | + | "name": "countries", |
|
+ | "url": "wikiraw:///Extension:Graph/Demo/RawData:WorldMap-iso2-json", |
||
⚫ | |||
⚫ | |||
⚫ | |||
− | + | "transform": [ |
|
⚫ | |||
⚫ | |||
⚫ | |||
+ | "scale": 80, |
||
+ | "translate":[0,0], |
||
+ | "projection": "equirectangular" |
||
+ | }, |
||
+ | { |
||
⚫ | |||
+ | "keys": [ "id" ], |
||
+ | "on": "highlights", |
||
+ | "onKey": "id", |
||
+ | "as": [ "zipped" ], |
||
+ | "default": { |
||
+ | "v": "#C0C0C0" |
||
+ | } |
||
+ | } |
||
⚫ | |||
} |
} |
||
− | + | ], |
|
− | + | "marks": [ |
|
− | { |
+ | { |
− | "type": " |
+ | "type": "path", |
− | " |
+ | "from": { |
− | " |
+ | "data": "countries" |
− | + | }, |
|
− | " |
+ | "properties": { |
− | + | "enter": { |
|
− | + | "path": { |
|
− | " |
+ | "field": "layout_path" |
− | + | } |
|
− | + | }, |
|
− | + | "update": { |
|
− | " |
+ | "fill": { |
− | + | "field": "zipped.v" |
|
− | + | } |
|
− | + | }, |
|
⚫ | |||
+ | "fill": { |
||
+ | "value": "#989898" |
||
+ | } |
||
+ | } |
||
⚫ | |||
} |
} |
||
− | + | ] |
|
− | } |
||
− | ] |
||
} |
} |
||
− | </graph> |
||
<graph> |
<graph> |
Версия от 15:40, 7 ноября 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" } } } } ]
}