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

Материал из wiki.energogroup.org
Перейти к навигации Перейти к поиску
 
(не показаны 4 промежуточные версии этого же участника)
Строка 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>
 
<graph>
 
{
 
{
  +
"version": 2,
"$schema": "https://vega.github.io/schema/vega/v5.json",
 
  +
"width": 1,
"description": "A basic bar chart example, with value labels shown upon mouse hover.",
 
"width": 400,
+
"height": 1,
"height": 200,
+
"data": [
  +
{
"padding": 5,
 
  +
"name": "highlights",
 
  +
"values": [{"id":"US","v":"blue"},{"id":"AU","v":"purple"},{"id":"CN","v":"red"},{"id":"BR","v":"pink"},{"id":"DZ","v":"green"}]
"data": [
 
{
 
"name": "table",
 
"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",
 
"value": {},
 
"on": [
 
{"events": "rect:mouseover", "update": "datum"},
 
{"events": "rect:mouseout", "update": "{}"}
 
]
 
}
 
],
 
 
"scales": [
 
{
 
"name": "xscale",
 
"type": "band",
 
"domain": {"data": "table", "field": "category"},
 
"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": [
 
{
 
"type": "rect",
 
"from": {"data":"table"},
 
"encode": {
 
"enter": {
 
"x": {"scale": "xscale", "field": "category"},
 
"width": {"scale": "xscale", "band": 1},
 
"y": {"scale": "yscale", "field": "amount"},
 
"y2": {"scale": "yscale", "value": 0}
 
 
},
 
},
"update": {
+
{
"fill": {"value": "steelblue"}
+
"name": "countries",
  +
"url": "wikiraw:///Extension:Graph/Demo/RawData:WorldMap-iso2-json",
},
 
  +
"format": {"type": "topojson", "feature": "countries"},
"hover": {
 
"fill": {"value": "red"}
+
"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": "text",
+
"type": "path",
"encode": {
+
"from": {
"enter": {
+
"data": "countries"
"align": {"value": "center"},
+
},
"baseline": {"value": "bottom"},
+
"properties": {
"fill": {"value": "#333"}
+
"enter": {
},
+
"path": {
"update": {
+
"field": "layout_path"
"x": {"scale": "xscale", "signal": "tooltip.category", "band": 0.5},
+
}
"y": {"scale": "yscale", "signal": "tooltip.amount", "offset": -2},
+
},
"text": {"signal": "tooltip.amount"},
+
"update": {
"fillOpacity": [
+
"fill": {
{"test": "datum === tooltip", "value": 0},
+
"field": "zipped.v"
{"value": 1}
+
}
]
+
},
  +
"hover": {
  +
"fill": {
  +
"value": "#989898"
  +
}
  +
}
  +
}
 
}
 
}
}
+
]
}
 
]
 
 
}
 
}
   

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

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