Vorlage:Graph:ToteNachGeschlecht: Unterschied zwischen den Versionen

Aus Puerto Patida Wiki
Zur Navigation springen Zur Suche springen
(Seite neu erstellt)
 
K (Datumskonvertierung korrigiert)
 
(6 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 8: Zeile 8:
 
   "width": {{{width|600}}},
 
   "width": {{{width|600}}},
 
   "height": {{{height|300}}},
 
   "height": {{{height|300}}},
   "padding": {"top": 20, "left": 70, "bottom": 30, "right": 70},
+
   "padding": {"top": 20, "left": 70, "bottom": 50, "right": 70},
 
   "data": [
 
   "data": [
 
     {
 
     {
 +
      "name": "sub",
 +
      "values": {{Data:Folgen}},
 +
      "transform": [
 +
  {
 +
        "type": "formula",
 +
        "field": "Datum",
 +
        "expr": "datetime(substring(datum.Datum,6,10), substring(datum.Datum,3,5)-1, substring(datum.Datum,0,2))"
 +
      },
 +
  {
 +
        "type": "aggregate",
 +
        "summarize": [{
 +
          "field": "Datum",
 +
          "ops": ["max"],
 +
          "as": ["Stand"]
 +
        }]
 +
      }
 +
  ]
 +
    },
 +
{
 
       "name": "table",
 
       "name": "table",
 
       "values": {{Data:Folgen}},
 
       "values": {{Data:Folgen}},
       "transform": [{
+
       "transform": [
 +
        {
 +
          "type": "fold",
 +
          "fields": ["KandidatInnen[0]", "KandidatInnen[1]", "KandidatInnen[2]", "KandidatInnen[3]", "KandidatInnen[4]", "KandidatInnen[5]", "KandidatInnen[6]", "KandidatInnen[7]", "KandidatInnen[8]", "KandidatInnen[9]"]
 +
        },
 +
        {
 +
          "type": "filter",
 +
          "test": "datum.value"
 +
        },
 +
  {
 +
        "type": "formula",
 +
        "field": "KandidatInGestorben",
 +
        "expr": "datum.value.Gestorben"
 +
      },
 +
  {
 +
        "type": "formula",
 +
        "field": "GeschlechtKandidatIn",
 +
        "expr": "datum.value.Geschlecht"
 +
      },
 +
  {
 +
        "type": "formula",
 +
        "field": "BürgerIn",
 +
        "expr": "datum.value.BürgerIn"
 +
      },
 +
  {
 
         "type": "aggregate",
 
         "type": "aggregate",
         "groupby": ["KandidatInGestorben", "GeschlechtKandidatIn"],
+
         "groupby": ["KandidatInGestorben", "BürgerIn", "GeschlechtKandidatIn"],
 
         "summarize": [{
 
         "summarize": [{
 
           "field": "*",
 
           "field": "*",
Zeile 21: Zeile 64:
 
           "as": ["Anzahl"]
 
           "as": ["Anzahl"]
 
         }]
 
         }]
       },{
+
       },
 +
  {
 
         "type": "stack",
 
         "type": "stack",
 
         "field": "Anzahl",
 
         "field": "Anzahl",
 
         "groupby": ["GeschlechtKandidatIn"],
 
         "groupby": ["GeschlechtKandidatIn"],
         "sortby": ["-KandidatInGestorben"]
+
         "sortby": ["BürgerIn", "-KandidatInGestorben"]
       },{
+
       },
 +
  {
 
         "type": "formula",
 
         "type": "formula",
 
         "field": "Schicksal",
 
         "field": "Schicksal",
         "expr": "datum.KandidatInGestorben? 'FriedhofsbewohnerIn' : 'BürgerIn'"
+
        "expr": "datum.BürgerIn ? 'BürgerIn' : 'HeimkehrerIn'"
       }]
+
      },
 +
  {
 +
        "type": "formula",
 +
        "field": "Schicksal",
 +
         "expr": "datum.KandidatInGestorben ? 'FriedhofsbewohnerIn' : datum.Schicksal"
 +
       }
 +
  ]
 
     }
 
     }
 
   ],
 
   ],
Zeile 46: Zeile 97:
 
       "domain": {"data": "table", "field": "layout_end"},
 
       "domain": {"data": "table", "field": "layout_end"},
 
       "nice": true
 
       "nice": true
 +
    },
 +
    {
 +
      "name": "sub",
 +
      "type": "ordinal",
 +
      "range": "width",
 +
      "domain": {"data": "sub", "field": "Stand"}
 
     },
 
     },
 
     {
 
     {
Zeile 51: Zeile 108:
 
       "type": "ordinal",
 
       "type": "ordinal",
 
       "domain": {"data": "table", "field": "Schicksal"},
 
       "domain": {"data": "table", "field": "Schicksal"},
       "range": "category10"
+
       "range": ["#00B7EB","#FFDB00","#F70070"]
 +
    },
 +
    {
 +
      "name": "colorHighlight",
 +
      "type": "ordinal",
 +
      "domain": {"data": "table", "field": "Schicksal"},
 +
      "range": ["#27CDFC","#FFE020","#FE2085"]
 
     }
 
     }
 
   ],
 
   ],
Zeile 71: Zeile 134:
 
         },
 
         },
 
         "title": {"fontSize": {"value": {{{fontSize|14}}} } }
 
         "title": {"fontSize": {"value": {{{fontSize|14}}} } }
 +
      }
 +
    },
 +
    {
 +
      "type": "x",
 +
      "scale": "sub",
 +
      "tickSize": 0,
 +
      "properties": {
 +
        "labels": {
 +
          "text": {"template": "#puertoStatistiko \u007b{datum.data{{!}}time:'%Y'}\u007d"},
 +
          "fontSize": {"value": {{{fontSize|14}}} },
 +
  "dx": {"value": {{{width|600}}}, "mult": -0.4},
 +
          "dy": {"value": {{{fontSize|14}}}, "mult": 2}
 +
        },
 +
        "axis": {
 +
          "strokeOpacity": {"value": 0}
 +
        }
 +
      }
 +
    },
 +
    {
 +
      "type": "x",
 +
      "scale": "sub",
 +
      "tickSize": 0,
 +
      "properties": {
 +
        "labels": {
 +
          "text": {"template": "Stand: \u007b{datum.data{{!}}time:'%d.%m.%Y'}\u007d"},
 +
          "fontSize": {"value": {{{fontSize|14}}} },
 +
  "dx": {"value": {{{width|600}}}, "mult": 0.4},
 +
          "dy": {"value": {{{fontSize|14}}}, "mult": 2},
 +
        },
 +
        "axis": {
 +
          "strokeOpacity": {"value": 0}
 +
        }
 
       }
 
       }
 
     }
 
     }
Zeile 81: Zeile 176:
 
         "enter": {
 
         "enter": {
 
           "x": {"scale": "x", "field": "GeschlechtKandidatIn", "offset":10},
 
           "x": {"scale": "x", "field": "GeschlechtKandidatIn", "offset":10},
           "width": {"scale": "x", "band": true, "offset": -10},
+
           "width": {"scale": "x", "band": true, "offset": -20},
 
           "y": {"scale": "y","field": "layout_end"},
 
           "y": {"scale": "y","field": "layout_end"},
 
           "y2": {"scale": "y","field": "layout_start"},
 
           "y2": {"scale": "y","field": "layout_start"},
Zeile 87: Zeile 182:
 
           "strokeWidth": {"value": 1.5},
 
           "strokeWidth": {"value": 1.5},
 
           "strokeOpacity": 1,
 
           "strokeOpacity": 1,
           "fill": {"scale": "color", "field": "Schicksal"},
+
        },
 +
        "update": {
 +
           "fill": {"scale": "color", "field": "Schicksal"}
 +
        },
 +
        "hover": {
 +
          "fill": {"scale": "colorHighlight", "field": "Schicksal"}
 
         }
 
         }
 
       }
 
       }
Zeile 97: Zeile 197:
 
       "title": " ",
 
       "title": " ",
 
       "offset": -100,
 
       "offset": -100,
 +
  "values": ["BürgerIn", "HeimkehrerIn", "FriedhofsbewohnerIn"],
 
       "properties": {
 
       "properties": {
 
         "title": {"fontSize": {"value": 2} },
 
         "title": {"fontSize": {"value": 2} },

Aktuelle Version vom 15. Oktober 2017, 14:52 Uhr

Die Statistik über die Anzahl Toter/Überlebender nach Geschlecht. Die zugrunde liegenden Daten können in der Daten-Vorlage angepasst werden

Vorschau