Template:Graph:PageHistory
This graph's main version resides at mediawiki Template:Graph:PageHistory.
Please make all the changes there and copy it everywhere else (until the copying is automated)
{{ Graph:PageHistory }} |
---|
<graph>
{ // // ATTENTION: This code is maintained at https://www.mediawiki.org/wiki/Template:Graph:PageHistory // Please do not modify it anywhere else, as it may get copied and override your changes. // Suggestions can be made at https://www.mediawiki.org/wiki/Template_talk:Graph:PageHistory // The graph uses Query API https://www.mediawiki.org/w/api.php?action=help&modules=query%2Brevisions // "$schema": "https://vega.github.io/schema/vega/v5.json", "width": 500, "height": 300, "autosize": { "type": "fit", "resize": false, "contains": "padding" }, // Loads last max (500) revisions of the given (or current) article "data": [ { "name": "values", "url": "https://www.mediawiki.org/w/api.php?action=query&format=json&formatversion=2&prop=revisions&titles=Template%3AGraph%3APageHistory&rvlimit=max&rvprop=timestamp%7Cuser%7Csize&rawcontinue", "format": { "type": "json", "property": "query.pages.[0].revisions", "parse": {"user":"string", "timestamp": "date", "size": "number"} }, }, { "name": "stats", "source": "values", "transform": [{"type": "aggregate", "groupby": ["timestamp"], "fields": ["size"], "ops": ["sum"]}] } ], "scales": [ { "name": "x", "type": "time", "range": "width", "domain": {"data": "values","fields": ["timestamp"]} }, { "name": "y", "type": "linear", "range": "height", "nice": true, "domain": {"data": "stats","fields": ["sum_size"]} }, { "name": "color", "type": "ordinal", "range": {"scheme": "category20"}, "domain": {"data": "values","fields": ["user"]} }], "axes": [ { "orient": "bottom", "scale": "x", "tickOffset": 0, "grid": true, "subdivide": 2, "encode": { "ticks": { "update": {"stroke": {"value": "#666666"} } }, "labels": { "update": {"fill": {"value": "#666666"},"angle": {"value": 30},"align": {"value": "left"} } }, "grid": { "update": {"stroke": {"value": "#cacaca"} } }, "axis": { "update": {"stroke": {"value": "#666666"},"strokeWidth": {"value": 2} } } } }, { "orient": "left", "scale": "y", "grid": true, "title": "Page size (bytes)", "encode": { "ticks": { "update": {"stroke": {"value": "#666666"} } }, "labels": { "update": {"fill": {"value": "#666666"} } }, "grid": { "update": {"stroke": {"value": "#cacaca"} } }, "axis": { "update": {"stroke": {"value": "#666666"},"strokeWidth": {"value": 2} } } } }], "legends": [{ "fill": "color", "title": "User", "offset": 10, "properties": {"symbols": {"stroke": {"value": "transparent"} } } }], "marks": [ { "type": "line", "from": {"data": "values"}, "encode": { "enter": { "x": {"scale": "x","field": "timestamp"}, "y": {"scale": "y","field": "size"}, "stroke": {"value": "#000"}, "strokeWidth": {"value": 1} } } }, { "type": "symbol", "from": {"data": "values"}, "encode": { "enter": { "x": {"scale": "x","field": "timestamp"}, "y": {"scale": "y","field": "size"}, "fill": {"scale": "color", "field": "user"}, "size": {"value": 15}, "stroke": {"scale": "color", "field": "user"} } } }] } </graph> |
<templatedata> { "params": { "1": { "label": "page name", "description": "Title of the page, or if missing, current article (not talk)" }, "height": {}, "overflow": {}, "width": {}, "wiki": { "label": "wiki project domain", "description": "Full domain of the wiki", "example": "en.wikipedia.org" }, "revisions": { "label": "number of revisions", "description": "Count of last revisions to show" }, "labelY": { "label": "localized label for Y axis" }, "display": { "label": "display", "description": "CSS display value of the graph", "autovalue": "block" } }, "paramOrder": [ "1", "wiki", "height", "width", "overflow", "revisions", "labelY", "display" ], "format": "inline" } </templatedata>
<graph>
{
//
// ATTENTION: This code is maintained at https://www.mediawiki.org/wiki/Template:Graph:PageHistory
// Please do not modify it anywhere else, as it may get copied and override your changes.
// Suggestions can be made at https://www.mediawiki.org/wiki/Template_talk:Graph:PageHistory
// The graph uses Query API https://www.mediawiki.org/w/api.php?action=help&modules=query%2Brevisions
//
"$schema": "https://vega.github.io/schema/vega/v5.json",
"width": 500,
"height": 300,
"autosize": {
"type": "fit",
"resize": false,
"contains": "padding"
},
// Loads last max (500) revisions of the given (or current) article
"data": [
{
"name": "values",
"url": "https://www.mediawiki.org/w/api.php?action=query&format=json&formatversion=2&prop=revisions&titles=Template%3AGraph%3APageHistory&rvlimit=max&rvprop=timestamp|user|size&rawcontinue",
"format": {
"type": "json",
"property": "query.pages.[0].revisions",
"parse": {"user":"string", "timestamp": "date", "size": "number"}
},
},
{
"name": "stats",
"source": "values",
"transform": [{"type": "aggregate", "groupby": ["timestamp"], "fields": ["size"], "ops": ["sum"]}]
}
],
"scales": [
{
"name": "x",
"type": "time",
"range": "width",
"domain": {"data": "values","fields": ["timestamp"]}
},
{
"name": "y",
"type": "linear",
"range": "height",
"nice": true,
"domain": {"data": "stats","fields": ["sum_size"]}
},
{
"name": "color",
"type": "ordinal",
"range": {"scheme": "category20"},
"domain": {"data": "values","fields": ["user"]}
}],
"axes": [
{
"orient": "bottom",
"scale": "x",
"tickOffset": 0,
"grid": true,
"subdivide": 2,
"encode": {
"ticks": { "update": {"stroke": {"value": "#666666"} } },
"labels": { "update": {"fill": {"value": "#666666"},"angle": {"value": 30},"align": {"value": "left"} } },
"grid": { "update": {"stroke": {"value": "#cacaca"} } },
"axis": { "update": {"stroke": {"value": "#666666"},"strokeWidth": {"value": 2} } }
}
},
{
"orient": "left",
"scale": "y",
"grid": true,
"title": "Page size (bytes)",
"encode": {
"ticks": { "update": {"stroke": {"value": "#666666"} } },
"labels": { "update": {"fill": {"value": "#666666"} } },
"grid": { "update": {"stroke": {"value": "#cacaca"} } },
"axis": { "update": {"stroke": {"value": "#666666"},"strokeWidth": {"value": 2} } }
}
}],
"legends": [{
"fill": "color",
"title": "User",
"offset": 10,
"properties": {"symbols": {"stroke": {"value": "transparent"} } }
}],
"marks": [
{
"type": "line",
"from": {"data": "values"},
"encode": {
"enter": {
"x": {"scale": "x","field": "timestamp"},
"y": {"scale": "y","field": "size"},
"stroke": {"value": "#000"},
"strokeWidth": {"value": 1}
}
}
},
{
"type": "symbol",
"from": {"data": "values"},
"encode": {
"enter": {
"x": {"scale": "x","field": "timestamp"},
"y": {"scale": "y","field": "size"},
"fill": {"scale": "color", "field": "user"},
"size": {"value": 15},
"stroke": {"scale": "color", "field": "user"}
}
}
}]
}
</graph>