Template:Page views double/sandbox
Daily pageviews of this page Last six months (log scale)
Last 30 days (linear scale)
|
This is the template sandbox page for Template:Page views double (diff). See also the companion subpage for test cases. |
Per Wikipedia:Templates for discussion/Log/2024 August 25#Template:Annual readership, this template is hidden from view until graphs is enabled again. |
Graphs are currently disabled Graphs are unavailable due to a known technical issue. Updates on reimplementing the Graph extension can be found on Phabricator and on MediaWiki.org. |
See pageviews.wmcloud.org for pageview graphs while built-in graphs are being repaired.
This template displays two page view graphs and is designed for articles with spiky page views; that is, articles that are mostly stable but may trend or go viral for short periods due to media attention or innate periodicity of the topic. The template reports daily page views in two stacked graphs (default: the last six months in log scale on the top, and the last 30 days in linear scale below), placing them in a suitable frame with individual headings. It is typically placed on an article's talk page below other talk page banners. Non-trending pages with stable viewership over time do not need to use this template; try the simpler {{Annual readership}} template instead.
Usage
[edit]Basic syntax:
{{Page views double}}
– one six-month log-scale graph on top, one 30-day linear-scale under it{{Page views double|days1=365|days2=60}}
– change to one year on top, two months on bottom{{Page views double|365|60}}
– same as above, using positional params|1=
and|2=
Template syntax with optional parameters:
{{Page views double|expanded=|target=|title=|days1=|days2=|color1=|color2=|scale1=|scale2=|width=|height=}}
Optional parameters
[edit]Overall parameters:
|expanded=
can be used to override the default auto-collapsing of the message box. To prevent the graph from being collapsed on page load, use|expanded=true
.|target=
(default: {{SUBJECTPAGENAME}}) can be used to simultaneously specify the page in the graph title (if|title=
is not specified) and the page for which page traffic is displayed.|title=
(default: see notes) can be used to specify the page in the graph title.|width=
(default: 570) may be used to change the width in pixels of the image.- Note: Default of 570px is used to match standard Talk page boxed items; values outside the range of 400–980 may be problematic.
|height=
(default: 200) may be used to change the height.
Top graph:
|days1=
(default: 182) can be used to change the number of pageview days depicted in the graph. Alias:|1=
.|color1=
(default: #f30) can be used to change the graph color; accepted inputs include HTML color names (e.g., red, slategray, cornsilk) and hex codes (e.g., #0080ff, #fc0).|scale1=
(default: log) can be used to change the scale of the y axis; accepted inputs: linear, log, pow, sqrt, quantile, quantize, and threshold.
Bottom graph:
|days2=
(default: 30) pageview days in bottom graph. Alias:|2=
.|color2=
(default: #0c6) graph color for bottom graph.|scale2=
(default: linear) can be used to change the scale of the y axis; accepted inputs: linear, log, pow, sqrt, quantile, quantize, and threshold.
Notes about the graph title
[edit]If neither |title=
or |target=
are specified, the graph title varies depending on the namespace of the page where this template is used.
- Title if placed on an article talk page:
- Daily pageviews of this article
- Title if placed on a page in any other talk namespace (e.g., "User talk:", "Template talk:", "Wikipedia talk:", etc.):
- Daily pageviews of {{SUBJECTPAGENAME}}
- Title if placed on any subject page (i.e., pages in namespaces like "User:", "Template:", "Wikipedia:", etc.):
- Daily pageviews of this page
If |title=
is not specified, but |target=
is specified, the graph title is set as "Daily pageviews of target page", with the target page linked.
If |title=
is specified, regardless of the specification of |target=
, the graph title is set as "Daily pageviews of text", with the text unlinked.
- For example, inputting
|title=XYZ
would set the graph title as:- Daily pageviews of XYZ
- For example, inputting
|title=[[XYZ]]
would set the graph title as:
Examples
[edit]
|
For comparison, here's the same template as above except with both graphs in linear scale: |
|
|
|
Template parameters
[edit]TemplateData for Page views double
This template inserts two vertically stacked graphs of daily pageview statistics (Y axis) over the past N days (X axis) for a page.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Target | target | May be used to specify the page for which page traffic is displayed, and the title (if empty).
| Page name | optional |
Title | title | May be used to specify the page name in the graph title (for default, see doc)
| String | optional |
Number of days back | 1 | Number of days back to show in the top chart
| Number | optional |
Number of days back to show in bottom chart | 2 | Number of days back to show in bottom chart
| Number | optional |
Graph color for top chart | color1 | Shade with which to highlight the data in the top chart
| String | optional |
Graph color for bottom chart | color2 | Shade with which to highlight the data in the bottomchart
| String | optional |
Graph scale for top chart | scale1 | Scaling could be one of these: linear, log, pow, sqrt, quantile, quantize, and threshold
| String | optional |
Graph scale for bottom chart | scale2 | Scaling could be one of these: linear, log, pow, sqrt, quantile, quantize, and threshold
| String | optional |
Expanded | expanded | Set to true to override the default collapsed state
| Boolean | optional |
Width | width | Width for the chart in pixels, if different from the default.
| Number | optional |
Height | height | Height for the chart in pixels, if different from the default.
| Number | optional |
Redirects
[edit]See also
[edit]- {{Annual readership}}
- {{Graph:PageViews}} – Use instead, if further variations are desired