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

Материал из wiki.energogroup.org
Перейти к навигации Перейти к поиску
Строка 1: Строка 1:
  +
{{GraphChart|width=400|height=100|type=line|x=1,2,3,4,5,6,7,8|y=10, 12, 6, 14, 2, 10, 7, 9}}
 
   
 
<graph>
 
<graph>
 
{
 
{
"version": 2,
+
"version": 2,
"width": 1,
+
"width": 100,
"height": 1,
+
"height": 100,
"data": [
+
"data": [
{
+
{
"name": "highlights",
+
"name": "table",
  +
"values": [12,23,47,6,52,19],
"values": [{"id":"US","v":"blue"},{"id":"AU","v":"purple"},{"id":"CN","v":"red"},{"id":"BR","v":"pink"},{"id":"DZ","v":"green"}]
 
 
"transform": [{"type": "pie","field": "data"}]
 
}
  +
],
 
"scales": [
 
{
 
"name": "r",
  +
"type": "sqrt",
  +
"domain": {"data": "table","field": "data"},
  +
"range": [20,100]
 
}
  +
],
  +
"marks": [
 
{
  +
"type": "arc",
  +
"from": {"data": "table"},
 
"properties": {
 
"enter": {
  +
"x": {"field": {"group": "width"},"mult": 0.5},
  +
"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"} },
{
 
"name": "countries",
+
"hover": {"fill": {"value": "pink"} }
 
}
"url": "wikiraw:///Extension:Graph/Demo/RawData:WorldMap-iso2-json",
 
 
},
"format": {"type": "topojson", "feature": "countries"},
 
  +
{
"transform": [
 
{
+
"type": "text",
"type": "geopath",
+
"from": {"data": "table"},
"value": "data",
+
"properties": {
"scale": 80,
+
"enter": {
"translate":[0,0],
+
"x": {"field": {"group": "width"},"mult": 0.5},
"projection": "equirectangular"
+
"y": {"field": {"group": "height"},"mult": 0.5},
},
+
"radius": {"scale": "r","field": "data","offset": 8},
{
+
"theta": {"field": "layout_mid"},
"type": "lookup",
+
"fill": {"value": "#000"},
"keys": [ "id" ],
+
"align": {"value": "center"},
"on": "highlights",
+
"baseline": {"value": "middle"},
"onKey": "id",
+
"text": {"field": "data"}
"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>

Версия от 14:44, 7 ноября 2022