Template:Graph:Moscow Metro expansion
{
"version": 2, "width": 1100, "height": 400,
"data": [
{
"name": "series_fields_names", "values": [ "l01","l02","l03","l04","l05","l06","l07","l08","l09","l10","l11","l12","l13","l14" ], "transform": [ {"type": "formula", "field": "orderSrc", "expr": "datum._id"}, ] }, { "name": "chart",
"url": "tabular:///moscow subway station counts.tab",
"format": {"type": "json"
, "property": "data"
}, "transform": [
{"type": "formula", "field": "_xfield", "expr":
"datetime(datum.year, 0, 1)"
}, {"type": "sort", "by": ["_xfield"]},
{"type": "fold", "fields": ["l01","l02","l03","l04","l05","l06","l07","l08","l09","l10","l11","l12","l13","l14"]},
{"type": "lookup", "on": "series_fields_names", "onKey": "data", "keys": ["key"], "as": ["keyItem"]}, {"type": "formula", "field": "keyOrder", "expr": "datum.keyItem.orderSrc"},
{
"type": "impute", "groupby": ["key"], "orderby": ["_xfield"], "field": "value", "method": "value", "value": 0 }, ] },
{
"name": "labels", "url": "tabular:///moscow subway station counts.tab", "format": {"type": "json", "property": "fields"}, "transform": [
] },
{ "name": "stats", "source": "chart", "transform": [{ "type": "aggregate", "groupby": ["_xfield"], "summarize": [{"field": "value", "ops": ["sum"]}] }] } ], "scales": [ { "name": "x", "type": "time", "domain": {"data": "chart", "field": "_xfield"},
"range": "width",
}, { "name": "y", "type": "linear", "range": "height", "domain": {"data": "stats", "field": "sum_value"}, }, { "name": "color", "type": "ordinal", "domain": {"data": "chart", "field": "key"}, "range":
["#D92B2C", "#44B85C", "#0078BF", "#19C1F3", "#894E35", "#F58631", "#8E479C", "#FFCB31", "#A1A2A3", "#B3D445", "#79CDCD", "#79CDCD", "#B0BFE7", "#DE64A1"],
},
{
"name": "labels", "type": "ordinal",
"domain": {"data": "labels", "field": "name"},
"range": {"data": "labels", "field": "title"}, } ],
"legends": [{
"fill": "color", "stroke": "color",
"title": "Line", "properties": { "labels": { "text": {"scale": "labels", "field": "data"} } }
}], "axes": [ { "scale": "x", "type": "x", "tickSizeEnd": 0, "ticks": 7, "properties": { "labels": { } }, }, { "scale": "y", "type": "y", "tickSizeEnd": 0, "title": "Number of stations", "grid": true, "properties": { "labels": { } }, } ],
"marks": [ {
"type": "group",
"from": { "data": "chart", "transform": [ {"type": "stack", "groupby": ["_xfield"], "sortby": ["-keyOrder"], "field": "value"}, {"type": "facet", "groupby": ["key"]} ] }, "marks": [ { "type": "area", "properties": { "hover": { "fill": {"value": "red"} }, "update": { "fill": {"scale": "color", "field": "key"} }, "enter": { "x": {"scale": "x", "field": "_xfield"}, "y": {"scale": "y", "field": "layout_start"}, "y2": {"scale": "y", "field": "layout_end"}, "fill": {"scale": "color", "field": "key"}, "interpolate": {"value": "monotone"} } } } ], },
{
"type": "text", "properties": { "enter": { "y": {"value": -15},
"x": {"signal": "width", "mult": 0.5, "offset": 30 },
"text": {"value": "Moscow Metro growth"}, "fontWeight": {"value": "bold"}, "align": {"value": "center"}, "baseline": {"value": "bottom"}, "fill": {"value": "#000"} } } } ]
} </graph>
You can find the data for this template at c:Data:Moscow subway station counts.tab.
Graph for the Moscow Metro station count over the years. Stations are grouped by lines. Lines are colour-coded.
Parameter | Description | Type | Status | |
---|---|---|---|---|
1 | 1 | graph width
| Number | suggested |
2 | 2 | graph height
| Number | suggested |