Bản mẫu:Page views double/doc

Bách khoa toàn thư mở Wikipedia

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[sửa mã nguồn]

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[sửa mã nguồn]

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[sửa mã nguồn]

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.

  • For example, inputting |target=XYZ would set the graph title as:
    Daily pageviews of XYZ

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:
    Daily pageviews of XYZ

Examples[sửa mã nguồn]

Template defaults (collapsed)

{{Page views double}} produces:

Template with a specified target page, shorter period in the top graph, and cobalt blue coloring in the bottom graph (collapsed)

{{Page views double|days1=150|target=Pancake|scale=log|color2=cobalt}} produces:

For comparison, here's the same template as above except with both graphs in linear scale:


Template with a target page with very spiky results, two-year period in the top log scale graph, (collapsed)

{{Page views double|target=Diwali|days1=730|days2=45}} produces:

Template with a specified target page, linear scale and same color in both graphs (uncollapsed)

{{Page views double|target=Rubber duck|color1=maroon|scale1=linear|color2=maroon}} produces:

Flip the graphs so the reddish, six-month interval log scale graph is on the bottom (collapsed)

{{Page views double|target=Rubber duck|days1=30|days2=182|color1=#0c6|color2=#f30|scale1=linear|scale2=log}}

Template parameters[sửa mã nguồn]

Đây là tài liệu Dữ liệu bản mẫu cho bản mẫu này được sử dụng bởi Trình soạn thảo trực quan và các công cụ khác; xem báo cáo sử dụng tham số hàng tháng cho bản mẫu này.

Dữ liệu bản mẫu cho 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.

Tham số bản mẫu

Nên dùng bản mẫu này với các tham số đặt thành khối.

Tham sốMiêu tảKiểuTrạng thái
Targettarget

May be used to specify the page for which page traffic is displayed, and the title (if empty).

Mặc định
Name of the current article page
Ví dụ
Main Page
Tên trangtùy chọn
Titletitle

May be used to specify the page name in the graph title (for default, see doc)

Mặc định
(varies per namespace, if none specified; see doc)
Chuỗi dàitùy chọn
Number of days back1

Number of days back to show in the top chart

Mặc định
182
Sốtùy chọn
Number of days back to show in bottom chart2

Number of days back to show in bottom chart

Mặc định
30
Sốtùy chọn
Graph color for top chartcolor1

Shade with which to highlight the data in the top chart

Mặc định
#f30
Ví dụ
#f00
Chuỗi dàitùy chọn
Graph color for bottom chartcolor2

Shade with which to highlight the data in the bottomchart

Mặc định
#0c6
Ví dụ
#f00
Chuỗi dàitùy chọn
Graph scale for top chartscale1

Scaling could be one of these: linear, log, pow, sqrt, quantile, quantize, and threshold

Mặc định
log
Ví dụ
linear
Chuỗi dàitùy chọn
Graph scale for bottom chartscale2

Scaling could be one of these: linear, log, pow, sqrt, quantile, quantize, and threshold

Mặc định
linear
Ví dụ
log
Chuỗi dàitùy chọn
Expandedexpanded

Set to true to override the default collapsed state

Mặc định
false
Luận lýtùy chọn
Widthwidth

Width for the chart in pixels, if different from the default.

Mặc định
470
Sốtùy chọn
Heightheight

Height for the chart in pixels, if different from the default.

Mặc định
200
Sốtùy chọn

Redirects[sửa mã nguồn]

See also[sửa mã nguồn]