Vorlage:Graph:Verkehrstote Deutschland
Beispiel
Der Graph kann mit folgendem Befehl eingefügt werden:
{{Graph:Verkehrstote Deutschland|frame=0|width=500}}
<graph> {
"version": 2, "width": 500, "height": 300, "padding": "strict",
"signals": [{"name": "rightwidth", "expr": "width + padding.right"}], "data": [{ "name": "chart",
"url": "tabular:///Verkehrstote Deutschland.tab",
"format": {"type": "json"
, "property": "data"
}, "transform": [ {"type": "formula", "field": "year", "expr": "datetime(datum.year,0,1)" }, {"type": "sort", "by": ["year"]},
{"type": "fold", "fields": ["dead"]}
] },
{
"name": "labels", "url": "tabular:///Verkehrstote Deutschland.tab", "format": {"type": "json", "property": "fields"} } ], "scales": [ { "name": "x", "type": "time", "domain": {"data": "chart", "field": "year"}, "range": "width",
"zero": false
}, { "name": "y", "type": "linear", "range": "height", "domain": {"data": "chart", "field": "value"},
"zero": true
}, { "name": "color", "type": "ordinal", "domain": {"data": "chart", "field": "key"}, "range": "category10" },
{
"name": "labels", "type": "ordinal",
"domain": {"data": "labels", "field": "name"},
"range": {"data": "labels", "field": "title"} } ],
"axes": [ {"scale": "x", "type": "x", "tickSizeEnd": 0, "ticks": 7, "title": "Jahr", "grid": true }, {"scale": "y", "type": "y", "tickSizeEnd": 0, "title": "Getötete", "grid": true
}
],
"marks": [ { "type": "group", "from": { "data": "chart", "transform": [{"type": "facet", "groupby": ["key"]}] }, "marks": [ { "type": "line", "properties": { "enter": { "y": {"scale": "y", "field": "value"}, "x": {"scale": "x", "field": "year"}, "stroke": {"scale": "color", "field": "key"}, "interpolate": {"value": "monotone"}, "strokeWidth": {"value": 2.5} } } } ] }, { "type": "text",
"from": {"data": "chart"},
"encode": { "enter": { "fill": {"value": "#900"}, "text": {"value": {"field":"event"} } }, "update": { "x": {"scale": "x","field": "year"}, "y": {"scale": "y", "field": "value"}, "dx": {"value": 10}, "align": {"value": "center"}, "baseline": {"value": 0}, "fontSize": {"value": 10}, "fontStyle": {"value": "normal"}, "fontWeight": {"value": "bold"} } } }, {
"type":"symbol", "from": {"data": "chart"}, "properties": { "enter": { "x": {"scale": "x", "field": "year"}, "y": {"scale": "y", "field": "dead"}, "fill": {"value": "#d44"}, "size": [ {"test": "length(datum.event)>0", "value": 50}, {"value": 0} ] } }
}, { "type":"text", "from": {"data": "chart"},
"properties": { "enter": { "x": {"scale": "x", "field": "year", "offset": 8}, "y": {"scale": "y", "field": "dead", "offset": 2}, "fill": {"value": "#d44"}, "dx":{"field": "labeloffset"}, "text": [ {"test": "length(datum.event)>0", "field": "event",
"align":[ {"test": "(datum.labeloffset) < 0",
"align": "right"},
{"align": "left"} ], "width":1
} ] } }
} ]
} </graph>
Rohdaten anzeigen oder bearbeiten
Template Data
Diese Vorlage fügt einen Graph der Entwicklung der Verkehrstoten in Deutschland ein.
Parameter | Beschreibung | Typ | Status | |
---|---|---|---|---|
Bildrahmen | frame | Standardmäßig ist ein Bildrahmen ähnlich des "mini" parameters bei der Bildeinbindung aktiviert. Auf 0 setzen um den Graph ohne Rahmen darzustellen.
| Boolesch | optional |
Ausrichtung | align | Horizontale Ausrichtung des Bildrahmens
| Inhalt | optional |
Breite | width | Breite des Bildrahmens in Pixel. Der Graph ist 70 pixel schmäler
| Nummer | optional |
Höhe | height | Höhe des Bildrahmens in Pixel
| Nummer | vorgeschlagen |
Bildunterschrift | caption | Alternative Beschriftung des Bildes wenn die standardmäßige Beschriftung überschrieben werden soll.
| Inhalt | optional |