Template:Graph:PageViews: Difference between revisions
Content deleted Content added
a few extra params |
No edit summary |
||
Line 15: | Line 15: | ||
}, |
}, |
||
"transform": [ |
"transform": [ |
||
{{ #if: {{{max|}}} |
|||
| { "type": "formula", "field": "views", "expr": "min(datum.views, {{{max}}})" }, |
|||
}} |
|||
{ "type": "formula", "field": "year", "expr": "parseInt(substring(datum.timestamp,0,4))" }, |
{ "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": "month", "expr": "parseInt(substring(datum.timestamp,4,6))" }, |
||
Line 34: | Line 31: | ||
{ |
{ |
||
"name": "y", |
"name": "y", |
||
"type": "linear", |
"type": "{{{scale|linear}}}", |
||
"range": "height", |
"range": "height", |
||
⚫ | |||
⚫ | |||
"clamp": true, |
|||
{{ #if: {{{max|}}} |
{{ #if: {{{max|}}} |
||
| " |
| "domainMax": {{{max}}}, |
||
⚫ | |||
}} |
}} |
||
⚫ | |||
} |
} |
||
], |
], |
||
Line 114: | Line 112: | ||
"default": "#00f", |
"default": "#00f", |
||
"example": "#f00", |
"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" |
"type": "string" |
||
}, |
}, |
||
Line 129: | Line 134: | ||
"3", |
"3", |
||
"color", |
"color", |
||
"scale", |
|||
"max" |
"max" |
||
], |
], |
Revision as of 12:45, 18 February 2016
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 |
---|---|
Inserts a graph with the page views statistics for the past N days of a page.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Number of days back | 1 | no description
| Number | suggested |
Page Title | 2 | Title of the page, with namespace, including needed spaces
| Page name | optional |
Domain | 3 | no description
| String | optional |
Graph color | color | no description
| String | optional |
Graph scale | scale | Scaling could be one of these: linear, log, pow, sqrt, quantile, quantize, and threshold
| String | optional |
Fix maximum value of the Y axis | max | This optional value might be useful to align multiple graphs side-by-side
| Number | optional |