Format: Diaspora/Graf: Diferență între versiuni

De la alegeri.md
Salt la: navigare, căutare
Linia 1: Linia 1:
 
<graph>{
 
<graph>{
"version": 2,
+
"version":2,
"description": "Votarea peste hotarele Republicii Moldova",
+
"description":"Votarea peste hotarele Republicii Moldova",
"height": 200,
+
"height":200,
"width": 850,
+
"width":850,
// "viewport": [945,230],
 
// "padding": 5,
 
//"padding": {"top": 15, "left": 33, "bottom": 25, "right": 1},
 
 
//
 
//
 
"data": [
 
"data": [
 
{
 
{
"name": "table",
+
"name":"table",
 
"values": [
 
"values": [
{"year": " 1994 ", "stations": 6, "voters": 1948},
+
{"year":" 1994 ", "stations":6, "voters":1948},
{"year": " 1996 ", "stations": 14, "voters": 3072},
+
{"year":" 1996 ", "stations":14, "voters":3072},
{"year": " 1998 ", "stations": 20, "voters": 3234},
+
{"year":" 1998 ", "stations":20, "voters":3234},
{"year": " 2001 ", "stations": 20, "voters": 3804},
+
{"year":" 2001 ", "stations":20, "voters":3804},
{"year": " 2005 ", "stations": 23, "voters": 10018},
+
{"year":" 2005 ", "stations":23, "voters":10018},
{"year": "apr 2009", "stations": 33, "voters": 16914},
+
{"year":"apr 2009", "stations":33, "voters":16914},
{"year": "iul 2009", "stations": 33, "voters": 17544},
+
{"year":"iul 2009", "stations":33, "voters":17544},
{"year": " 2010 ", "stations": 75, "voters": 64199},
+
{"year":" 2010 ", "stations":75, "voters":64199},
{"year": " 2014 ", "stations": 95, "voters": 73311},
+
{"year":" 2014 ", "stations":95, "voters":73311},
{"year": " 2016 ", "stations": 100, "voters": 67205},
+
{"year":" 2016 ", "stations":100, "voters":67205},
{"year": " 2019 ", "stations": 123, "voters": 76583},
+
{"year":" 2019 ", "stations":123, "voters":76583},
 
]
 
]
 
}
 
}
Linia 29: Linia 26:
 
"signals": [
 
"signals": [
 
{
 
{
"name": "tooltip",
+
"name":"tooltip",
 
"init": {},
 
"init": {},
 
"streams": [
 
"streams": [
{"type": "rect:mouseover", "expr": "datum"},
+
{"type":"rect:mouseover", "expr":"datum"},
{"type": "rect:mouseout", "expr": "{}"}
+
{"type":"rect:mouseout", "expr":"{}"}
 
]
 
]
 
}
 
}
Linia 40: Linia 37:
 
"predicates": [
 
"predicates": [
 
{
 
{
"name": "tooltip", "type": "==",  
+
"name":"tooltip", "type":"==",  
"operands": [{"signal": "tooltip._id"}, {"arg": "id"}]
+
"operands": [{"signal":"tooltip._id"}, {"arg":"id"}]
 
}
 
}
 
],
 
],
Linia 47: Linia 44:
 
"scales": [
 
"scales": [
 
{
 
{
"name": "x",
+
"name":"x",
"type": "ordinal",
+
"type":"ordinal",
"range": "width",
+
"range":"width",
//"width": {"value":10},
+
"padding":0.74,
"padding": 0.74,
+
// "round":true,
// "round": true,
+
"domain": {"data":"table", "field":"year"}
"domain": {"data": "table", "field": "year"}
 
 
},
 
},
 
{
 
{
"name": "y",
+
"name":"y",
"type": "linear",
+
"type":"linear",
"range": "height",
+
"range":"height",
"nice": true,
+
"nice":true,
"domain": {"data": "table", "field": "stations"}
+
"domain": {"data":"table", "field":"stations"}
 
},
 
},
 
{
 
{
"name": "y2",
+
"name":"y2",
"type": "linear",
+
"type":"linear",
"range": "height",
+
"range":"height",
"nice": true,
+
"nice":true,
"domain": {"data": "table", "field": "voters"}
+
"domain": {"data":"table", "field":"voters"}
 
}
 
}
 
],
 
],
Linia 73: Linia 69:
 
"axes": [
 
"axes": [
 
{
 
{
"type": "x",
+
"type":"x",
"scale": "x",
+
"scale":"x",
// "grid": true,
 
//"values": ["7 mar", "31 iul"],
 
 
"properties":
 
"properties":
 
{
 
{
"ticks": {"stroke": {"value": "#aaa"}},
+
"ticks": {"stroke": {"value":"#aaa"}},
"labels": {"fill": {"value": "#666"}, "fontSize": {"value": 12}},
+
"labels": {"fill": {"value":"#666"}, "fontSize": {"value":12}},
"axis": {"stroke": {"value": "#ccc"}}
+
"axis": {"stroke": {"value":"#ccc"}}
 
}
 
}
 
},
 
},
 
{
 
{
"type": "y",
+
"type":"y",
"scale": "y",
+
"scale":"y",
"ticks": 6, // кол-во значений на оси y
+
"ticks":6,
"orient": "right",
+
"orient":"right",
"title": "Secții de votare",
+
"title":"Secții de votare",
//"grid": true,
 
 
"properties":
 
"properties":
 
{
 
{
"ticks": {"stroke": {"value": "#d9d9d9"}},
+
"ticks": {"stroke": {"value":"#d9d9d9"}},
"labels": {"fill": {"value": "#666"}, "fontSize":{"value": 12}},
+
"labels": {"fill": {"value":"#666"}, "fontSize":{"value":12}},
"axis": {"stroke": {"value": "#ccc"}},
+
"axis": {"stroke": {"value":"#ccc"}},
"title": {"fill": {"value":"#999"}, "fontSize": {"value":12}, "fontWeight": {"value":"italic"}, "x": {"value": -10}}
+
"title": {"fill": {"value":"#999"}, "fontSize": {"value":12}, "fontWeight": {"value":"italic"}, "x": {"value":-10}}
 
}
 
}
 
},
 
},
 
{
 
{
"type": "y",
+
"type":"y",
"scale": "y2",
+
"scale":"y2",
"title": "Alegători",
+
"title":"Alegători",
"grid": true,
+
"grid":true,
 
"properties":
 
"properties":
 
{
 
{
"ticks": {"stroke": {"value": "#d9d9d9"}},
+
"ticks": {"stroke": {"value":"#d9d9d9"}},
"labels": {"fill": {"value": "#666"}, "fontSize": {"value": 12}},
+
"labels": {"fill": {"value":"#666"}, "fontSize": {"value": 12}},
"axis": {"stroke": {"value": "#ccc"}},
+
"axis": {"stroke": {"value":"#ccc"}},
 
"title": {"fill": {"value":"#a6c26b"}, "fontSize": {"value":12}, "fontWeight": {"value":"italic"}, "x": {"value":10}}
 
"title": {"fill": {"value":"#a6c26b"}, "fontSize": {"value":12}, "fontWeight": {"value":"italic"}, "x": {"value":10}}
 
}
 
}
Linia 116: Linia 109:
 
"marks": [
 
"marks": [
 
{
 
{
"type": "rect",
+
"type":"rect",
"from": {"data": "table"},
+
"from": {"data":"table"},
 
"properties": {
 
"properties": {
 
"enter": {
 
"enter": {
"x": {"scale": "x", "field": "year"},
+
"x": {"scale":"x", "field":"year"},
"width": {"scale": "x", "band":true, "offset":0},
+
"width": {"scale":"x", "band":true, "offset":0},
"y": {"scale": "y", "field": "stations"},
+
"y": {"scale":"y", "field":"stations"},
"y2": {"scale": "y", "value": 0},
+
"y2": {"scale":"y", "value":0},
 
},
 
},
"update": {"fill": {"value": "#ccc"}},
+
"update": {"fill": {"value":"#ccc"}},
"hover": {"fill": {"value": "#999"}},
+
"hover": {"fill": {"value":"#999"}},
 
}
 
}
 
},
 
},
Linia 138: Linia 131:
 
"stroke": {"value":"#9bbb59"},
 
"stroke": {"value":"#9bbb59"},
 
"strokeWidth": {"value":2},
 
"strokeWidth": {"value":2},
//"interpolate": {"value":"step-after"}
+
//"interpolate": {"value":"linear"}
 
}
 
}
 
}
 
}
 
},
 
},
 
    {
 
    {
      "type": "symbol",
+
      "type":"symbol",
      "from": {"data": "table"},
+
      "from": {"data":"table"},
 
      "properties": {
 
      "properties": {
 
        "enter": {
 
        "enter": {
          "x": {"scale": "x","field": "year", "offset":9},
+
          "x": {"scale":"x", "field":"year", "offset":9},
          "y": {"scale": "y2","field": "voters"},
+
          "y": {"scale":"y2", "field":"voters"},
          "stroke": {"value": "#9bbb59"},
+
          "stroke": {"value":"#9bbb59"},
          "fill": {"value": "white"},
+
          "fill": {"value":"white"},
          "size": {"value": 20}
+
          "size": {"value":20}
 
        }
 
        }
 
      }
 
      }
 
    },
 
    },
 
{
 
{
"type": "text",
+
"type":"text",
 
"properties": {
 
"properties": {
 
"enter": {
 
"enter": {
"align": {"value": "center"},
+
"align": {"value":"center"},
"fill": {"value": "#666"},
+
"fill": {"value":"#666"},
 
},
 
},
 
"update": {
 
"update": {
"x": {"scale": "x", "signal": "tooltip.year"},
+
"x": {"scale":"x", "signal":"tooltip.year"},
"dx": {"scale": "x", "mult": 0.5, "band": true},
+
"dx": {"scale":"x", "mult":0.5, "band":true},
"y": {"scale": "y", "offset": -4, "signal": "tooltip.stations"},
+
"y": {"scale":"y", "offset":-4, "signal":"tooltip.stations"},
"text": {"signal": "tooltip.stations"},
+
"text": {"signal":"tooltip.stations"},
"fontSize": {"value": 12},
+
"fontSize": {"value":12},
 
"fillOpacity": {
 
"fillOpacity": {
 
"rule": [
 
"rule": [
 
{
 
{
"predicate": {"name": "tooltip", "id": {"value": null}},
+
"predicate": {"name":"tooltip", "id": {"value":null}},
"value": 0
+
"value":0
 
},
 
},
{"value": 1}
+
{"value":1}
 
]
 
]
 
}
 
}
Linia 185: Linia 178:
 
"enter": {
 
"enter": {
 
"x": {"signal":"width", "mult":0.5},
 
"x": {"signal":"width", "mult":0.5},
"y": {"value": -10},
+
"y": {"value":-10},
 
"text": {"template":"Votarea în străinătate în perioada 1994–2019"},
 
"text": {"template":"Votarea în străinătate în perioada 1994–2019"},
 
"fill": {"value":"#336"},
 
"fill": {"value":"#336"},

Versiunea de la data 12 august 2020 17:17