Template:Graph:PageHistory

From Bonkipedia
Revision as of 18:05, 12 November 2022 by ManfredoDo (talk | contribs) (1 revision imported: Template documentation pages)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Template documentation


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
 //
 "version": 2,
 "width": 500,
 "height": 300,
 // Loads last max (500) revisions of the given (or current) article
 "data": [
   {
     "name": "values",
     "url": "wikiapi:///?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": {"timestamp": "date","size": "number"}
     },
   },
   {
     "name": "stats",
     "source": "values",
     "transform": [{"type": "aggregate", "groupby": ["timestamp"], "summarize": {"size": "sum"} }]
   }
 ],
 "scales": [
 {
   "name": "x",
   "type": "time",
   "range": "width",
   "domain": {"data": "values","field": "timestamp"}
 },
 {
   "name": "y",
   "type": "linear",
   "range": "height",
   "nice": true,
   "domain": {"data": "stats","field": "sum_size"}
 },
 {
   "name": "color",
   "type": "ordinal",
   "range": "category20",
   "domain": {"data": "values","field": "user"}
 }],
 "axes": [
 {
   "type": "x",
   "scale": "x",
   "tickSizeEnd": 0,
   "grid": true,
   "subdivide": 2,
   "properties": {
     "ticks": {"stroke": {"value": "#666666"} },
     "labels": {"fill": {"value": "#666666"},"angle": {"value": 30},"align": {"value": "left"} },
     "grid": {"stroke": {"value": "#cacaca"} },
     "axis": {"stroke": {"value": "#666666"},"strokeWidth": {"value": 2} }
   }
 },
 {
   "type": "y",
   "scale": "y",
   "grid": true,
   "title": "Page size (bytes)",
   "properties": {
     "ticks": {"stroke": {"value": "#666666"} },
     "labels": {"fill": {"value": "#666666"} },
     "grid": {"stroke": {"value": "#cacaca"} },
     "axis": {"stroke": {"value": "#666666"},"strokeWidth": {"value": 2} }
   }
 }],
 "legends": [{
   "fill": "color",
   "title": "User",
   "offset": 10,
   "properties": {"symbols": {"stroke": {"value": "transparent"} } }
 }],
 "marks": [
 {
   "type": "line",
   "from": {"data": "values"},
   "properties": {
     "enter": {
       "x": {"scale": "x","field": "timestamp"},
       "y": {"scale": "y","field": "size"},
       "stroke": {"value": "#000"},
       "strokeWidth": {"value": 1}
     }
   }
 },
 {
   "type": "symbol",
   "from": {"data": "values"},
   "properties": {
     "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>

No description.

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
page name1

Title of the page, or if missing, current article (not talk)

Unknownoptional
wiki project domainwiki

Full domain of the wiki

Example
en.wikipedia.org
Unknownoptional
heightheight

no description

Unknownoptional
widthwidth

no description

Unknownoptional
overflowoverflow

no description

Unknownoptional
number of revisionsrevisions

Count of last revisions to show

Unknownoptional
localized label for Y axislabelY

no description

Unknownoptional
displaydisplay

CSS display value of the graph

Auto value
block
Unknownoptional
<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
  //

  "version": 2,
  "width": 500,
  "height": 300,

  // Loads last max (500) revisions of the given (or current) article
  "data": [
    {
      "name": "values",
      "url": "wikiapi:///?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": {"timestamp": "date","size": "number"}
      },
    },
    {
      "name": "stats",
      "source": "values",
      "transform": [{"type": "aggregate", "groupby": ["timestamp"], "summarize": {"size": "sum"} }]
    }
  ],

  "scales": [
  {
    "name": "x",
    "type": "time",
    "range": "width",
    "domain": {"data": "values","field": "timestamp"}
  },
  {
    "name": "y",
    "type": "linear",
    "range": "height",
    "nice": true,
    "domain": {"data": "stats","field": "sum_size"}
  },
  {
    "name": "color",
    "type": "ordinal",
    "range": "category20",
    "domain": {"data": "values","field": "user"}
  }],

  "axes": [
  {
    "type": "x",
    "scale": "x",
    "tickSizeEnd": 0,
    "grid": true,
    "subdivide": 2,
    "properties": {
      "ticks": {"stroke": {"value": "#666666"} },
      "labels": {"fill": {"value": "#666666"},"angle": {"value": 30},"align": {"value": "left"} },
      "grid": {"stroke": {"value": "#cacaca"} },
      "axis": {"stroke": {"value": "#666666"},"strokeWidth": {"value": 2} }
    }
  },
  {
    "type": "y",
    "scale": "y",
    "grid": true,
    "title": "Page size (bytes)",
    "properties": {
      "ticks": {"stroke": {"value": "#666666"} },
      "labels": {"fill": {"value": "#666666"} },
      "grid": {"stroke": {"value": "#cacaca"} },
      "axis": {"stroke": {"value": "#666666"},"strokeWidth": {"value": 2} }
    }
  }],

  "legends": [{
    "fill": "color",
    "title": "User",
    "offset": 10,
    "properties": {"symbols": {"stroke": {"value": "transparent"} } }
  }],

  "marks": [
  {
    "type": "line",
    "from": {"data": "values"},
    "properties": {
      "enter": {
        "x": {"scale": "x","field": "timestamp"},
        "y": {"scale": "y","field": "size"},
        "stroke": {"value": "#000"},
        "strokeWidth": {"value": 1}
      }
    }
  },
  {
    "type": "symbol",
    "from": {"data": "values"},
    "properties": {
      "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>