Template:Graph:PageViews
This graph's main version resides at mediawiki Template:Graph:PageViews. Please make all the changes there and copy it everywhere else (until the copying is automated)
{{ Graph:PageViews }} 30 days for the current page (if there is data) |
{{ Graph:PageViews | 90 | Main Page | en.wikipedia.org }} 90 days for Main Page on English Wikipedia |
---|---|
<graph>
{ "version": 2, "width": 400, "height": 200, "data": [ { "name": "pageviews", "url": "wikirest://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/www.scientowiki.com/all-access/user/Template:Graph:PageViews/daily/2024041707/2024051707", "format": { "type": "json", "property": "items" }, "transform": [ { "type": "formula", "field": "year", "expr": "parseInt(substring(datum.timestamp,0,4))" }, { "type": "formula", "field": "month", "expr": "parseInt(substring(datum.timestamp,4,6))" }, { "type": "formula", "field": "day", "expr": "parseInt(substring(datum.timestamp,6,8))" }, { "type": "formula", "field": "date", "expr": "datetime(datum.year,datum.month-1,datum.day)" } ] } ], "scales": [ { "name": "x", "type": "time", "range": "width", "domain": {"data": "pageviews","field": "date"} }, { "name": "y", "type": "linear", "range": "height", "domain": {"data": "pageviews","field": "views"}, "clamp": true, "nice": true } ], "axes": [ {"type": "x","scale": "x","ticks": 5}, {"type": "y","scale": "y", "grid":true, "ticks": 5} ], "marks": [ { "type": "line", "from": {"data": "pageviews"}, "properties": { "enter": { "x": {"scale": "x","field": "date"}, "y": {"scale": "y","field": "views"}, "stroke": {"value": "#00f"}, "strokeWidth": {"value": 3}, "interpolate": {"value": "monotone"} } } }, { "type": "area", "from": {"data": "pageviews"}, "properties": { "enter": { "x": {"scale": "x","field": "date"}, "y": {"scale": "y","value": 0}, "y2": {"scale": "y","field": "views"}, "fill": {"value": "#00f"}, "fillOpacity": {"value": 0.35}, "interpolate": {"value": "monotone"} } } } ] } </graph> |
<graph>
{ "version": 2, "width": 400, "height": 200, "data": [ { "name": "pageviews", "url": "wikirest://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/en.wikipedia.org/all-access/user/Main_Page/daily/2024021707/2024051707", "format": { "type": "json", "property": "items" }, "transform": [ { "type": "formula", "field": "year", "expr": "parseInt(substring(datum.timestamp,0,4))" }, { "type": "formula", "field": "month", "expr": "parseInt(substring(datum.timestamp,4,6))" }, { "type": "formula", "field": "day", "expr": "parseInt(substring(datum.timestamp,6,8))" }, { "type": "formula", "field": "date", "expr": "datetime(datum.year,datum.month-1,datum.day)" } ] } ], "scales": [ { "name": "x", "type": "time", "range": "width", "domain": {"data": "pageviews","field": "date"} }, { "name": "y", "type": "linear", "range": "height", "domain": {"data": "pageviews","field": "views"}, "clamp": true, "nice": true } ], "axes": [ {"type": "x","scale": "x","ticks": 5}, {"type": "y","scale": "y", "grid":true, "ticks": 5} ], "marks": [ { "type": "line", "from": {"data": "pageviews"}, "properties": { "enter": { "x": {"scale": "x","field": "date"}, "y": {"scale": "y","field": "views"}, "stroke": {"value": "#00f"}, "strokeWidth": {"value": 3}, "interpolate": {"value": "monotone"} } } }, { "type": "area", "from": {"data": "pageviews"}, "properties": { "enter": { "x": {"scale": "x","field": "date"}, "y": {"scale": "y","value": 0}, "y2": {"scale": "y","field": "views"}, "fill": {"value": "#00f"}, "fillOpacity": {"value": 0.35}, "interpolate": {"value": "monotone"} } } } ] } </graph> |
<templatedata> { "params": { "1": { "type": "number", "default": "30", "suggested": true, "label": "Number of days back" }, "2": { "label": "Page Title", "description": "Title of the page, with namespace, including needed spaces", "type": "wiki-page-name", "default": "Name of the current article page (even if on talk page)", "example": "Main Page" }, "3": { "label": "Domain", "default": "Current wiki", "example": "en.wikipedia.org", "type": "string" }, "color": { "label": "Graph color", "default": "#00f", "example": "#f00", "type": "string" }, "scale": { "label": "Graph scale", "description": "Scaling could be one of these: linear, log, pow, sqrt, quantile, quantize, and threshold", "default": "linear", "example": "log", "type": "string" }, "max": { "label": "Fix maximum value of the Y axis", "description": "This optional value might be useful to align multiple graphs side-by-side", "default": "auto", "example": "10000", "type": "number" } }, "paramOrder": [ "1", "2", "3", "color", "scale", "max" ], "format": "inline", "description": "Inserts a graph with the page views statistics for the past N days of a page." } </templatedata>