• Home
  • Random
  • Recent changes
  • Special pages
  • Settings
  • About MOASSpedia
  • Disclaimers
MOASSpedia
  • 216.73.216.55
  • Talk
  • Watchlist
  • Contributions
  • Log in

Template:Page views double

Template Discussion
  • Language
  • Watch
  • History
  • Edit
    • Page information
    • Permanent link
    • What links here
Softies-icons-trends 256px.png
Daily pageviews of this page

Last six months (log scale) <graph> {

 //
 // ATTENTION: This code is maintained at https://www.mediawiki.org/wiki/Template:Graph:PageViews
 //            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:PageViews
 //            The graph uses PageViews API https://wikitech.wikimedia.org/wiki/Analytics/PageviewAPI
 //
 "version": 2,
 "width": 470,
 "height": 200,
 // The data for this graph comes from the PageView API.  The request is made for N days back up to now.
 "data": [
   {
     "name": "pageviews",
     "url": "wikirest://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/moasspedia.org/all-access/user/Template%3APage%20views%20double/daily/2025080700/2026020500",
     "format": {
       "type": "json",
       "property": "items"
     },
     // The response is parsed here, converting date strings of form "20160223" into date 2016-02-23
     "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": [
   // The dates are scaled to the "x" axis - the width of the graph
   {
     "name": "x",
     "type": "time",
     "range": "width",
     "domain": {"data": "pageviews","field": "date"}
   },
   // The pageviews are scaled to the "y" axis - the height of the graph
   // Optional scale parameter can change "linear" to other scales like log
   // Optional max parameter can fix the upper bound of the graph
   {
     "name": "y",
     "type": "log",
     "range": "height",
     "domain": {"data": "pageviews","field": "views"},
     "clamp": true,
     "nice": true
   }
 ],
 // Simple axis with horizontal grid lines
 "axes": [
   {
     "type": "x",
     "scale": "x",
     "ticks": 5,
     "properties": {
       "ticks": {"stroke": {"value": "#666666"} },
       "labels": {"fill": {"value": "#666666"} },
       "axis": {"stroke": {"value": "#666666"}, "strokeWidth": {"value": 2} }
     }
   },
   {
     "type": "y",
     "scale": "y",
     "ticks": 5,
     "grid": true,
     "properties": {
       "ticks": {"stroke": {"value": "#666666"} },
       "labels": {"fill": {"value": "#666666"} },
       "grid": {"stroke": {"value": "#666666"}, "strokeWidth": {"value": 2} },
       "axis": {"stroke": {"value": "#666666"}, "strokeWidth": {"value": 2} }
     }
   }
 ],
 // The graph is drawn with two elements a thick line at the top, and a semi-transparent area below
 "marks": [
   {
     "type": "line",
     "from": {"data": "pageviews"},
     "properties": {
       "enter": {
         "x": {"scale": "x","field": "date"},
         "y": {"scale": "y","field": "views"},
         "stroke": {"value": "#f30"},
         "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": "#f30"},
         "fillOpacity": {"value": 0.35},
         "interpolate": {"value": "monotone"}
       }
     }
   }
 ]

} </graph> Last 30 days (linear scale) <graph> {

 //
 // ATTENTION: This code is maintained at https://www.mediawiki.org/wiki/Template:Graph:PageViews
 //            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:PageViews
 //            The graph uses PageViews API https://wikitech.wikimedia.org/wiki/Analytics/PageviewAPI
 //
 "version": 2,
 "width": 470,
 "height": 200,
 // The data for this graph comes from the PageView API.  The request is made for N days back up to now.
 "data": [
   {
     "name": "pageviews",
     "url": "wikirest://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/moasspedia.org/all-access/user/Template%3APage%20views%20double/daily/2026010600/2026020500",
     "format": {
       "type": "json",
       "property": "items"
     },
     // The response is parsed here, converting date strings of form "20160223" into date 2016-02-23
     "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": [
   // The dates are scaled to the "x" axis - the width of the graph
   {
     "name": "x",
     "type": "time",
     "range": "width",
     "domain": {"data": "pageviews","field": "date"}
   },
   // The pageviews are scaled to the "y" axis - the height of the graph
   // Optional scale parameter can change "linear" to other scales like log
   // Optional max parameter can fix the upper bound of the graph
   {
     "name": "y",
     "type": "linear",
     "range": "height",
     "domain": {"data": "pageviews","field": "views"},
     "clamp": true,
     "nice": true
   }
 ],
 // Simple axis with horizontal grid lines
 "axes": [
   {
     "type": "x",
     "scale": "x",
     "ticks": 5,
     "properties": {
       "ticks": {"stroke": {"value": "#666666"} },
       "labels": {"fill": {"value": "#666666"} },
       "axis": {"stroke": {"value": "#666666"}, "strokeWidth": {"value": 2} }
     }
   },
   {
     "type": "y",
     "scale": "y",
     "ticks": 5,
     "grid": true,
     "properties": {
       "ticks": {"stroke": {"value": "#666666"} },
       "labels": {"fill": {"value": "#666666"} },
       "grid": {"stroke": {"value": "#666666"}, "strokeWidth": {"value": 2} },
       "axis": {"stroke": {"value": "#666666"}, "strokeWidth": {"value": 2} }
     }
   }
 ],
 // The graph is drawn with two elements a thick line at the top, and a semi-transparent area below
 "marks": [
   {
     "type": "line",
     "from": {"data": "pageviews"},
     "properties": {
       "enter": {
         "x": {"scale": "x","field": "date"},
         "y": {"scale": "y","field": "views"},
         "stroke": {"value": "#0c6"},
         "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": "#0c6"},
         "fillOpacity": {"value": 0.35},
         "interpolate": {"value": "monotone"}
       }
     }
   }
 ]

}

</graph>
Template documentation[view] [edit] [history] [purge]

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.

Contents

  • 1 Usage
  • 2 Optional parameters
  • 3 Notes about the graph title
  • 4 Examples
  • 5 Template parameters
  • 6 Redirects
  • 7 See also

Usage

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

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

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

Template defaults (collapsed)

{{Page views double}} produces:

Softies-icons-trends 256px.png
Daily pageviews of this page

Last six months (log scale) <graph> {

 //
 // ATTENTION: This code is maintained at https://www.mediawiki.org/wiki/Template:Graph:PageViews
 //            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:PageViews
 //            The graph uses PageViews API https://wikitech.wikimedia.org/wiki/Analytics/PageviewAPI
 //
 "version": 2,
 "width": 470,
 "height": 200,
 // The data for this graph comes from the PageView API.  The request is made for N days back up to now.
 "data": [
   {
     "name": "pageviews",
     "url": "wikirest://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/moasspedia.org/all-access/user/Template%3APage%20views%20double/daily/2025080700/2026020500",
     "format": {
       "type": "json",
       "property": "items"
     },
     // The response is parsed here, converting date strings of form "20160223" into date 2016-02-23
     "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": [
   // The dates are scaled to the "x" axis - the width of the graph
   {
     "name": "x",
     "type": "time",
     "range": "width",
     "domain": {"data": "pageviews","field": "date"}
   },
   // The pageviews are scaled to the "y" axis - the height of the graph
   // Optional scale parameter can change "linear" to other scales like log
   // Optional max parameter can fix the upper bound of the graph
   {
     "name": "y",
     "type": "log",
     "range": "height",
     "domain": {"data": "pageviews","field": "views"},
     "clamp": true,
     "nice": true
   }
 ],
 // Simple axis with horizontal grid lines
 "axes": [
   {
     "type": "x",
     "scale": "x",
     "ticks": 5,
     "properties": {
       "ticks": {"stroke": {"value": "#666666"} },
       "labels": {"fill": {"value": "#666666"} },
       "axis": {"stroke": {"value": "#666666"}, "strokeWidth": {"value": 2} }
     }
   },
   {
     "type": "y",
     "scale": "y",
     "ticks": 5,
     "grid": true,
     "properties": {
       "ticks": {"stroke": {"value": "#666666"} },
       "labels": {"fill": {"value": "#666666"} },
       "grid": {"stroke": {"value": "#666666"}, "strokeWidth": {"value": 2} },
       "axis": {"stroke": {"value": "#666666"}, "strokeWidth": {"value": 2} }
     }
   }
 ],
 // The graph is drawn with two elements a thick line at the top, and a semi-transparent area below
 "marks": [
   {
     "type": "line",
     "from": {"data": "pageviews"},
     "properties": {
       "enter": {
         "x": {"scale": "x","field": "date"},
         "y": {"scale": "y","field": "views"},
         "stroke": {"value": "#f30"},
         "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": "#f30"},
         "fillOpacity": {"value": 0.35},
         "interpolate": {"value": "monotone"}
       }
     }
   }
 ]

} </graph> Last 30 days (linear scale) <graph> {

 //
 // ATTENTION: This code is maintained at https://www.mediawiki.org/wiki/Template:Graph:PageViews
 //            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:PageViews
 //            The graph uses PageViews API https://wikitech.wikimedia.org/wiki/Analytics/PageviewAPI
 //
 "version": 2,
 "width": 470,
 "height": 200,
 // The data for this graph comes from the PageView API.  The request is made for N days back up to now.
 "data": [
   {
     "name": "pageviews",
     "url": "wikirest://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/moasspedia.org/all-access/user/Template%3APage%20views%20double/daily/2026010600/2026020500",
     "format": {
       "type": "json",
       "property": "items"
     },
     // The response is parsed here, converting date strings of form "20160223" into date 2016-02-23
     "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": [
   // The dates are scaled to the "x" axis - the width of the graph
   {
     "name": "x",
     "type": "time",
     "range": "width",
     "domain": {"data": "pageviews","field": "date"}
   },
   // The pageviews are scaled to the "y" axis - the height of the graph
   // Optional scale parameter can change "linear" to other scales like log
   // Optional max parameter can fix the upper bound of the graph
   {
     "name": "y",
     "type": "linear",
     "range": "height",
     "domain": {"data": "pageviews","field": "views"},
     "clamp": true,
     "nice": true
   }
 ],
 // Simple axis with horizontal grid lines
 "axes": [
   {
     "type": "x",
     "scale": "x",
     "ticks": 5,
     "properties": {
       "ticks": {"stroke": {"value": "#666666"} },
       "labels": {"fill": {"value": "#666666"} },
       "axis": {"stroke": {"value": "#666666"}, "strokeWidth": {"value": 2} }
     }
   },
   {
     "type": "y",
     "scale": "y",
     "ticks": 5,
     "grid": true,
     "properties": {
       "ticks": {"stroke": {"value": "#666666"} },
       "labels": {"fill": {"value": "#666666"} },
       "grid": {"stroke": {"value": "#666666"}, "strokeWidth": {"value": 2} },
       "axis": {"stroke": {"value": "#666666"}, "strokeWidth": {"value": 2} }
     }
   }
 ],
 // The graph is drawn with two elements a thick line at the top, and a semi-transparent area below
 "marks": [
   {
     "type": "line",
     "from": {"data": "pageviews"},
     "properties": {
       "enter": {
         "x": {"scale": "x","field": "date"},
         "y": {"scale": "y","field": "views"},
         "stroke": {"value": "#0c6"},
         "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": "#0c6"},
         "fillOpacity": {"value": 0.35},
         "interpolate": {"value": "monotone"}
       }
     }
   }
 ]

}

</graph>
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:

Softies-icons-trends 256px.png
Daily pageviews of Pancake

Last 150 days (log scale) <graph> {

 //
 // ATTENTION: This code is maintained at https://www.mediawiki.org/wiki/Template:Graph:PageViews
 //            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:PageViews
 //            The graph uses PageViews API https://wikitech.wikimedia.org/wiki/Analytics/PageviewAPI
 //
 "version": 2,
 "width": 470,
 "height": 200,
 // The data for this graph comes from the PageView API.  The request is made for N days back up to now.
 "data": [
   {
     "name": "pageviews",
     "url": "wikirest://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/moasspedia.org/all-access/user/Pancake/daily/2025090800/2026020500",
     "format": {
       "type": "json",
       "property": "items"
     },
     // The response is parsed here, converting date strings of form "20160223" into date 2016-02-23
     "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": [
   // The dates are scaled to the "x" axis - the width of the graph
   {
     "name": "x",
     "type": "time",
     "range": "width",
     "domain": {"data": "pageviews","field": "date"}
   },
   // The pageviews are scaled to the "y" axis - the height of the graph
   // Optional scale parameter can change "linear" to other scales like log
   // Optional max parameter can fix the upper bound of the graph
   {
     "name": "y",
     "type": "log",
     "range": "height",
     "domain": {"data": "pageviews","field": "views"},
     "clamp": true,
     "nice": true
   }
 ],
 // Simple axis with horizontal grid lines
 "axes": [
   {
     "type": "x",
     "scale": "x",
     "ticks": 5,
     "properties": {
       "ticks": {"stroke": {"value": "#666666"} },
       "labels": {"fill": {"value": "#666666"} },
       "axis": {"stroke": {"value": "#666666"}, "strokeWidth": {"value": 2} }
     }
   },
   {
     "type": "y",
     "scale": "y",
     "ticks": 5,
     "grid": true,
     "properties": {
       "ticks": {"stroke": {"value": "#666666"} },
       "labels": {"fill": {"value": "#666666"} },
       "grid": {"stroke": {"value": "#666666"}, "strokeWidth": {"value": 2} },
       "axis": {"stroke": {"value": "#666666"}, "strokeWidth": {"value": 2} }
     }
   }
 ],
 // The graph is drawn with two elements a thick line at the top, and a semi-transparent area below
 "marks": [
   {
     "type": "line",
     "from": {"data": "pageviews"},
     "properties": {
       "enter": {
         "x": {"scale": "x","field": "date"},
         "y": {"scale": "y","field": "views"},
         "stroke": {"value": "#f30"},
         "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": "#f30"},
         "fillOpacity": {"value": 0.35},
         "interpolate": {"value": "monotone"}
       }
     }
   }
 ]

} </graph> Last 30 days (linear scale) <graph> {

 //
 // ATTENTION: This code is maintained at https://www.mediawiki.org/wiki/Template:Graph:PageViews
 //            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:PageViews
 //            The graph uses PageViews API https://wikitech.wikimedia.org/wiki/Analytics/PageviewAPI
 //
 "version": 2,
 "width": 470,
 "height": 200,
 // The data for this graph comes from the PageView API.  The request is made for N days back up to now.
 "data": [
   {
     "name": "pageviews",
     "url": "wikirest://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/moasspedia.org/all-access/user/Pancake/daily/2026010600/2026020500",
     "format": {
       "type": "json",
       "property": "items"
     },
     // The response is parsed here, converting date strings of form "20160223" into date 2016-02-23
     "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": [
   // The dates are scaled to the "x" axis - the width of the graph
   {
     "name": "x",
     "type": "time",
     "range": "width",
     "domain": {"data": "pageviews","field": "date"}
   },
   // The pageviews are scaled to the "y" axis - the height of the graph
   // Optional scale parameter can change "linear" to other scales like log
   // Optional max parameter can fix the upper bound of the graph
   {
     "name": "y",
     "type": "linear",
     "range": "height",
     "domain": {"data": "pageviews","field": "views"},
     "clamp": true,
     "nice": true
   }
 ],
 // Simple axis with horizontal grid lines
 "axes": [
   {
     "type": "x",
     "scale": "x",
     "ticks": 5,
     "properties": {
       "ticks": {"stroke": {"value": "#666666"} },
       "labels": {"fill": {"value": "#666666"} },
       "axis": {"stroke": {"value": "#666666"}, "strokeWidth": {"value": 2} }
     }
   },
   {
     "type": "y",
     "scale": "y",
     "ticks": 5,
     "grid": true,
     "properties": {
       "ticks": {"stroke": {"value": "#666666"} },
       "labels": {"fill": {"value": "#666666"} },
       "grid": {"stroke": {"value": "#666666"}, "strokeWidth": {"value": 2} },
       "axis": {"stroke": {"value": "#666666"}, "strokeWidth": {"value": 2} }
     }
   }
 ],
 // The graph is drawn with two elements a thick line at the top, and a semi-transparent area below
 "marks": [
   {
     "type": "line",
     "from": {"data": "pageviews"},
     "properties": {
       "enter": {
         "x": {"scale": "x","field": "date"},
         "y": {"scale": "y","field": "views"},
         "stroke": {"value": "cobalt"},
         "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": "cobalt"},
         "fillOpacity": {"value": 0.35},
         "interpolate": {"value": "monotone"}
       }
     }
   }
 ]

}

</graph>

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

Softies-icons-trends 256px.png
Daily pageviews of Pancake

Last 150 days (linear scale) <graph> {

 //
 // ATTENTION: This code is maintained at https://www.mediawiki.org/wiki/Template:Graph:PageViews
 //            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:PageViews
 //            The graph uses PageViews API https://wikitech.wikimedia.org/wiki/Analytics/PageviewAPI
 //
 "version": 2,
 "width": 470,
 "height": 200,
 // The data for this graph comes from the PageView API.  The request is made for N days back up to now.
 "data": [
   {
     "name": "pageviews",
     "url": "wikirest://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/moasspedia.org/all-access/user/Pancake/daily/2025090800/2026020500",
     "format": {
       "type": "json",
       "property": "items"
     },
     // The response is parsed here, converting date strings of form "20160223" into date 2016-02-23
     "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": [
   // The dates are scaled to the "x" axis - the width of the graph
   {
     "name": "x",
     "type": "time",
     "range": "width",
     "domain": {"data": "pageviews","field": "date"}
   },
   // The pageviews are scaled to the "y" axis - the height of the graph
   // Optional scale parameter can change "linear" to other scales like log
   // Optional max parameter can fix the upper bound of the graph
   {
     "name": "y",
     "type": "linear",
     "range": "height",
     "domain": {"data": "pageviews","field": "views"},
     "clamp": true,
     "nice": true
   }
 ],
 // Simple axis with horizontal grid lines
 "axes": [
   {
     "type": "x",
     "scale": "x",
     "ticks": 5,
     "properties": {
       "ticks": {"stroke": {"value": "#666666"} },
       "labels": {"fill": {"value": "#666666"} },
       "axis": {"stroke": {"value": "#666666"}, "strokeWidth": {"value": 2} }
     }
   },
   {
     "type": "y",
     "scale": "y",
     "ticks": 5,
     "grid": true,
     "properties": {
       "ticks": {"stroke": {"value": "#666666"} },
       "labels": {"fill": {"value": "#666666"} },
       "grid": {"stroke": {"value": "#666666"}, "strokeWidth": {"value": 2} },
       "axis": {"stroke": {"value": "#666666"}, "strokeWidth": {"value": 2} }
     }
   }
 ],
 // The graph is drawn with two elements a thick line at the top, and a semi-transparent area below
 "marks": [
   {
     "type": "line",
     "from": {"data": "pageviews"},
     "properties": {
       "enter": {
         "x": {"scale": "x","field": "date"},
         "y": {"scale": "y","field": "views"},
         "stroke": {"value": "#f30"},
         "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": "#f30"},
         "fillOpacity": {"value": 0.35},
         "interpolate": {"value": "monotone"}
       }
     }
   }
 ]

} </graph> Last 30 days (linear scale) <graph> {

 //
 // ATTENTION: This code is maintained at https://www.mediawiki.org/wiki/Template:Graph:PageViews
 //            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:PageViews
 //            The graph uses PageViews API https://wikitech.wikimedia.org/wiki/Analytics/PageviewAPI
 //
 "version": 2,
 "width": 470,
 "height": 200,
 // The data for this graph comes from the PageView API.  The request is made for N days back up to now.
 "data": [
   {
     "name": "pageviews",
     "url": "wikirest://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/moasspedia.org/all-access/user/Pancake/daily/2026010600/2026020500",
     "format": {
       "type": "json",
       "property": "items"
     },
     // The response is parsed here, converting date strings of form "20160223" into date 2016-02-23
     "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": [
   // The dates are scaled to the "x" axis - the width of the graph
   {
     "name": "x",
     "type": "time",
     "range": "width",
     "domain": {"data": "pageviews","field": "date"}
   },
   // The pageviews are scaled to the "y" axis - the height of the graph
   // Optional scale parameter can change "linear" to other scales like log
   // Optional max parameter can fix the upper bound of the graph
   {
     "name": "y",
     "type": "linear",
     "range": "height",
     "domain": {"data": "pageviews","field": "views"},
     "clamp": true,
     "nice": true
   }
 ],
 // Simple axis with horizontal grid lines
 "axes": [
   {
     "type": "x",
     "scale": "x",
     "ticks": 5,
     "properties": {
       "ticks": {"stroke": {"value": "#666666"} },
       "labels": {"fill": {"value": "#666666"} },
       "axis": {"stroke": {"value": "#666666"}, "strokeWidth": {"value": 2} }
     }
   },
   {
     "type": "y",
     "scale": "y",
     "ticks": 5,
     "grid": true,
     "properties": {
       "ticks": {"stroke": {"value": "#666666"} },
       "labels": {"fill": {"value": "#666666"} },
       "grid": {"stroke": {"value": "#666666"}, "strokeWidth": {"value": 2} },
       "axis": {"stroke": {"value": "#666666"}, "strokeWidth": {"value": 2} }
     }
   }
 ],
 // The graph is drawn with two elements a thick line at the top, and a semi-transparent area below
 "marks": [
   {
     "type": "line",
     "from": {"data": "pageviews"},
     "properties": {
       "enter": {
         "x": {"scale": "x","field": "date"},
         "y": {"scale": "y","field": "views"},
         "stroke": {"value": "cobalt"},
         "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": "cobalt"},
         "fillOpacity": {"value": 0.35},
         "interpolate": {"value": "monotone"}
       }
     }
   }
 ]

}

</graph>

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:

Softies-icons-trends 256px.png
Daily pageviews of Diwali

Last 730 days (log scale) <graph> {

 //
 // ATTENTION: This code is maintained at https://www.mediawiki.org/wiki/Template:Graph:PageViews
 //            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:PageViews
 //            The graph uses PageViews API https://wikitech.wikimedia.org/wiki/Analytics/PageviewAPI
 //
 "version": 2,
 "width": 470,
 "height": 200,
 // The data for this graph comes from the PageView API.  The request is made for N days back up to now.
 "data": [
   {
     "name": "pageviews",
     "url": "wikirest://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/moasspedia.org/all-access/user/Diwali/daily/2024020600/2026020500",
     "format": {
       "type": "json",
       "property": "items"
     },
     // The response is parsed here, converting date strings of form "20160223" into date 2016-02-23
     "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": [
   // The dates are scaled to the "x" axis - the width of the graph
   {
     "name": "x",
     "type": "time",
     "range": "width",
     "domain": {"data": "pageviews","field": "date"}
   },
   // The pageviews are scaled to the "y" axis - the height of the graph
   // Optional scale parameter can change "linear" to other scales like log
   // Optional max parameter can fix the upper bound of the graph
   {
     "name": "y",
     "type": "log",
     "range": "height",
     "domain": {"data": "pageviews","field": "views"},
     "clamp": true,
     "nice": true
   }
 ],
 // Simple axis with horizontal grid lines
 "axes": [
   {
     "type": "x",
     "scale": "x",
     "ticks": 5,
     "properties": {
       "ticks": {"stroke": {"value": "#666666"} },
       "labels": {"fill": {"value": "#666666"} },
       "axis": {"stroke": {"value": "#666666"}, "strokeWidth": {"value": 2} }
     }
   },
   {
     "type": "y",
     "scale": "y",
     "ticks": 5,
     "grid": true,
     "properties": {
       "ticks": {"stroke": {"value": "#666666"} },
       "labels": {"fill": {"value": "#666666"} },
       "grid": {"stroke": {"value": "#666666"}, "strokeWidth": {"value": 2} },
       "axis": {"stroke": {"value": "#666666"}, "strokeWidth": {"value": 2} }
     }
   }
 ],
 // The graph is drawn with two elements a thick line at the top, and a semi-transparent area below
 "marks": [
   {
     "type": "line",
     "from": {"data": "pageviews"},
     "properties": {
       "enter": {
         "x": {"scale": "x","field": "date"},
         "y": {"scale": "y","field": "views"},
         "stroke": {"value": "#f30"},
         "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": "#f30"},
         "fillOpacity": {"value": 0.35},
         "interpolate": {"value": "monotone"}
       }
     }
   }
 ]

} </graph> Last 45 days (linear scale) <graph> {

 //
 // ATTENTION: This code is maintained at https://www.mediawiki.org/wiki/Template:Graph:PageViews
 //            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:PageViews
 //            The graph uses PageViews API https://wikitech.wikimedia.org/wiki/Analytics/PageviewAPI
 //
 "version": 2,
 "width": 470,
 "height": 200,
 // The data for this graph comes from the PageView API.  The request is made for N days back up to now.
 "data": [
   {
     "name": "pageviews",
     "url": "wikirest://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/moasspedia.org/all-access/user/Diwali/daily/2025122200/2026020500",
     "format": {
       "type": "json",
       "property": "items"
     },
     // The response is parsed here, converting date strings of form "20160223" into date 2016-02-23
     "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": [
   // The dates are scaled to the "x" axis - the width of the graph
   {
     "name": "x",
     "type": "time",
     "range": "width",
     "domain": {"data": "pageviews","field": "date"}
   },
   // The pageviews are scaled to the "y" axis - the height of the graph
   // Optional scale parameter can change "linear" to other scales like log
   // Optional max parameter can fix the upper bound of the graph
   {
     "name": "y",
     "type": "linear",
     "range": "height",
     "domain": {"data": "pageviews","field": "views"},
     "clamp": true,
     "nice": true
   }
 ],
 // Simple axis with horizontal grid lines
 "axes": [
   {
     "type": "x",
     "scale": "x",
     "ticks": 5,
     "properties": {
       "ticks": {"stroke": {"value": "#666666"} },
       "labels": {"fill": {"value": "#666666"} },
       "axis": {"stroke": {"value": "#666666"}, "strokeWidth": {"value": 2} }
     }
   },
   {
     "type": "y",
     "scale": "y",
     "ticks": 5,
     "grid": true,
     "properties": {
       "ticks": {"stroke": {"value": "#666666"} },
       "labels": {"fill": {"value": "#666666"} },
       "grid": {"stroke": {"value": "#666666"}, "strokeWidth": {"value": 2} },
       "axis": {"stroke": {"value": "#666666"}, "strokeWidth": {"value": 2} }
     }
   }
 ],
 // The graph is drawn with two elements a thick line at the top, and a semi-transparent area below
 "marks": [
   {
     "type": "line",
     "from": {"data": "pageviews"},
     "properties": {
       "enter": {
         "x": {"scale": "x","field": "date"},
         "y": {"scale": "y","field": "views"},
         "stroke": {"value": "#0c6"},
         "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": "#0c6"},
         "fillOpacity": {"value": 0.35},
         "interpolate": {"value": "monotone"}
       }
     }
   }
 ]

}

</graph>
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:

Softies-icons-trends 256px.png
Daily pageviews of Rubber duck

Last six months (linear scale) <graph> {

 //
 // ATTENTION: This code is maintained at https://www.mediawiki.org/wiki/Template:Graph:PageViews
 //            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:PageViews
 //            The graph uses PageViews API https://wikitech.wikimedia.org/wiki/Analytics/PageviewAPI
 //
 "version": 2,
 "width": 470,
 "height": 200,
 // The data for this graph comes from the PageView API.  The request is made for N days back up to now.
 "data": [
   {
     "name": "pageviews",
     "url": "wikirest://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/moasspedia.org/all-access/user/Rubber%20duck/daily/2025080700/2026020500",
     "format": {
       "type": "json",
       "property": "items"
     },
     // The response is parsed here, converting date strings of form "20160223" into date 2016-02-23
     "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": [
   // The dates are scaled to the "x" axis - the width of the graph
   {
     "name": "x",
     "type": "time",
     "range": "width",
     "domain": {"data": "pageviews","field": "date"}
   },
   // The pageviews are scaled to the "y" axis - the height of the graph
   // Optional scale parameter can change "linear" to other scales like log
   // Optional max parameter can fix the upper bound of the graph
   {
     "name": "y",
     "type": "linear",
     "range": "height",
     "domain": {"data": "pageviews","field": "views"},
     "clamp": true,
     "nice": true
   }
 ],
 // Simple axis with horizontal grid lines
 "axes": [
   {
     "type": "x",
     "scale": "x",
     "ticks": 5,
     "properties": {
       "ticks": {"stroke": {"value": "#666666"} },
       "labels": {"fill": {"value": "#666666"} },
       "axis": {"stroke": {"value": "#666666"}, "strokeWidth": {"value": 2} }
     }
   },
   {
     "type": "y",
     "scale": "y",
     "ticks": 5,
     "grid": true,
     "properties": {
       "ticks": {"stroke": {"value": "#666666"} },
       "labels": {"fill": {"value": "#666666"} },
       "grid": {"stroke": {"value": "#666666"}, "strokeWidth": {"value": 2} },
       "axis": {"stroke": {"value": "#666666"}, "strokeWidth": {"value": 2} }
     }
   }
 ],
 // The graph is drawn with two elements a thick line at the top, and a semi-transparent area below
 "marks": [
   {
     "type": "line",
     "from": {"data": "pageviews"},
     "properties": {
       "enter": {
         "x": {"scale": "x","field": "date"},
         "y": {"scale": "y","field": "views"},
         "stroke": {"value": "maroon"},
         "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": "maroon"},
         "fillOpacity": {"value": 0.35},
         "interpolate": {"value": "monotone"}
       }
     }
   }
 ]

} </graph> Last 30 days (linear scale) <graph> {

 //
 // ATTENTION: This code is maintained at https://www.mediawiki.org/wiki/Template:Graph:PageViews
 //            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:PageViews
 //            The graph uses PageViews API https://wikitech.wikimedia.org/wiki/Analytics/PageviewAPI
 //
 "version": 2,
 "width": 470,
 "height": 200,
 // The data for this graph comes from the PageView API.  The request is made for N days back up to now.
 "data": [
   {
     "name": "pageviews",
     "url": "wikirest://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/moasspedia.org/all-access/user/Rubber%20duck/daily/2026010600/2026020500",
     "format": {
       "type": "json",
       "property": "items"
     },
     // The response is parsed here, converting date strings of form "20160223" into date 2016-02-23
     "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": [
   // The dates are scaled to the "x" axis - the width of the graph
   {
     "name": "x",
     "type": "time",
     "range": "width",
     "domain": {"data": "pageviews","field": "date"}
   },
   // The pageviews are scaled to the "y" axis - the height of the graph
   // Optional scale parameter can change "linear" to other scales like log
   // Optional max parameter can fix the upper bound of the graph
   {
     "name": "y",
     "type": "linear",
     "range": "height",
     "domain": {"data": "pageviews","field": "views"},
     "clamp": true,
     "nice": true
   }
 ],
 // Simple axis with horizontal grid lines
 "axes": [
   {
     "type": "x",
     "scale": "x",
     "ticks": 5,
     "properties": {
       "ticks": {"stroke": {"value": "#666666"} },
       "labels": {"fill": {"value": "#666666"} },
       "axis": {"stroke": {"value": "#666666"}, "strokeWidth": {"value": 2} }
     }
   },
   {
     "type": "y",
     "scale": "y",
     "ticks": 5,
     "grid": true,
     "properties": {
       "ticks": {"stroke": {"value": "#666666"} },
       "labels": {"fill": {"value": "#666666"} },
       "grid": {"stroke": {"value": "#666666"}, "strokeWidth": {"value": 2} },
       "axis": {"stroke": {"value": "#666666"}, "strokeWidth": {"value": 2} }
     }
   }
 ],
 // The graph is drawn with two elements a thick line at the top, and a semi-transparent area below
 "marks": [
   {
     "type": "line",
     "from": {"data": "pageviews"},
     "properties": {
       "enter": {
         "x": {"scale": "x","field": "date"},
         "y": {"scale": "y","field": "views"},
         "stroke": {"value": "maroon"},
         "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": "maroon"},
         "fillOpacity": {"value": 0.35},
         "interpolate": {"value": "monotone"}
       }
     }
   }
 ]

}

</graph>
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}}

Softies-icons-trends 256px.png
Daily pageviews of Rubber duck

Last 30 days (linear scale) <graph> {

 //
 // ATTENTION: This code is maintained at https://www.mediawiki.org/wiki/Template:Graph:PageViews
 //            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:PageViews
 //            The graph uses PageViews API https://wikitech.wikimedia.org/wiki/Analytics/PageviewAPI
 //
 "version": 2,
 "width": 470,
 "height": 200,
 // The data for this graph comes from the PageView API.  The request is made for N days back up to now.
 "data": [
   {
     "name": "pageviews",
     "url": "wikirest://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/moasspedia.org/all-access/user/Rubber%20duck/daily/2026010600/2026020500",
     "format": {
       "type": "json",
       "property": "items"
     },
     // The response is parsed here, converting date strings of form "20160223" into date 2016-02-23
     "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": [
   // The dates are scaled to the "x" axis - the width of the graph
   {
     "name": "x",
     "type": "time",
     "range": "width",
     "domain": {"data": "pageviews","field": "date"}
   },
   // The pageviews are scaled to the "y" axis - the height of the graph
   // Optional scale parameter can change "linear" to other scales like log
   // Optional max parameter can fix the upper bound of the graph
   {
     "name": "y",
     "type": "linear",
     "range": "height",
     "domain": {"data": "pageviews","field": "views"},
     "clamp": true,
     "nice": true
   }
 ],
 // Simple axis with horizontal grid lines
 "axes": [
   {
     "type": "x",
     "scale": "x",
     "ticks": 5,
     "properties": {
       "ticks": {"stroke": {"value": "#666666"} },
       "labels": {"fill": {"value": "#666666"} },
       "axis": {"stroke": {"value": "#666666"}, "strokeWidth": {"value": 2} }
     }
   },
   {
     "type": "y",
     "scale": "y",
     "ticks": 5,
     "grid": true,
     "properties": {
       "ticks": {"stroke": {"value": "#666666"} },
       "labels": {"fill": {"value": "#666666"} },
       "grid": {"stroke": {"value": "#666666"}, "strokeWidth": {"value": 2} },
       "axis": {"stroke": {"value": "#666666"}, "strokeWidth": {"value": 2} }
     }
   }
 ],
 // The graph is drawn with two elements a thick line at the top, and a semi-transparent area below
 "marks": [
   {
     "type": "line",
     "from": {"data": "pageviews"},
     "properties": {
       "enter": {
         "x": {"scale": "x","field": "date"},
         "y": {"scale": "y","field": "views"},
         "stroke": {"value": "#0c6"},
         "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": "#0c6"},
         "fillOpacity": {"value": 0.35},
         "interpolate": {"value": "monotone"}
       }
     }
   }
 ]

} </graph> Last 182 days (log scale) <graph> {

 //
 // ATTENTION: This code is maintained at https://www.mediawiki.org/wiki/Template:Graph:PageViews
 //            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:PageViews
 //            The graph uses PageViews API https://wikitech.wikimedia.org/wiki/Analytics/PageviewAPI
 //
 "version": 2,
 "width": 470,
 "height": 200,
 // The data for this graph comes from the PageView API.  The request is made for N days back up to now.
 "data": [
   {
     "name": "pageviews",
     "url": "wikirest://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/moasspedia.org/all-access/user/Rubber%20duck/daily/2025080700/2026020500",
     "format": {
       "type": "json",
       "property": "items"
     },
     // The response is parsed here, converting date strings of form "20160223" into date 2016-02-23
     "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": [
   // The dates are scaled to the "x" axis - the width of the graph
   {
     "name": "x",
     "type": "time",
     "range": "width",
     "domain": {"data": "pageviews","field": "date"}
   },
   // The pageviews are scaled to the "y" axis - the height of the graph
   // Optional scale parameter can change "linear" to other scales like log
   // Optional max parameter can fix the upper bound of the graph
   {
     "name": "y",
     "type": "log",
     "range": "height",
     "domain": {"data": "pageviews","field": "views"},
     "clamp": true,
     "nice": true
   }
 ],
 // Simple axis with horizontal grid lines
 "axes": [
   {
     "type": "x",
     "scale": "x",
     "ticks": 5,
     "properties": {
       "ticks": {"stroke": {"value": "#666666"} },
       "labels": {"fill": {"value": "#666666"} },
       "axis": {"stroke": {"value": "#666666"}, "strokeWidth": {"value": 2} }
     }
   },
   {
     "type": "y",
     "scale": "y",
     "ticks": 5,
     "grid": true,
     "properties": {
       "ticks": {"stroke": {"value": "#666666"} },
       "labels": {"fill": {"value": "#666666"} },
       "grid": {"stroke": {"value": "#666666"}, "strokeWidth": {"value": 2} },
       "axis": {"stroke": {"value": "#666666"}, "strokeWidth": {"value": 2} }
     }
   }
 ],
 // The graph is drawn with two elements a thick line at the top, and a semi-transparent area below
 "marks": [
   {
     "type": "line",
     "from": {"data": "pageviews"},
     "properties": {
       "enter": {
         "x": {"scale": "x","field": "date"},
         "y": {"scale": "y","field": "views"},
         "stroke": {"value": "#f30"},
         "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": "#f30"},
         "fillOpacity": {"value": 0.35},
         "interpolate": {"value": "monotone"}
       }
     }
   }
 ]

}

</graph>

Template parameters

This is the TemplateData for this template used by TemplateWizard, VisualEditor and other tools. Click here to see a monthly parameter usage report for this template based on this TemplateData.

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.

Template parameters

This template prefers block formatting of parameters.

ParameterDescriptionTypeStatus
Targettarget

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

Default
Name of the current article page
Example
Main Page
Page nameoptional
Titletitle

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

Default
(varies per namespace, if none specified; see doc)
Stringoptional
Number of days back1

Number of days back to show in the top chart

Default
182
Numberoptional
Number of days back to show in bottom chart2

Number of days back to show in bottom chart

Default
30
Numberoptional
Graph color for top chartcolor1

Shade with which to highlight the data in the top chart

Default
#f30
Example
#f00
Stringoptional
Graph color for bottom chartcolor2

Shade with which to highlight the data in the bottomchart

Default
#0c6
Example
#f00
Stringoptional
Graph scale for top chartscale1

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

Default
log
Example
linear
Stringoptional
Graph scale for bottom chartscale2

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

Default
linear
Example
log
Stringoptional
Expandedexpanded

Set to true to override the default collapsed state

Default
false
Booleanoptional
Widthwidth

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

Default
470
Numberoptional
Heightheight

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

Default
200
Numberoptional

Redirects

  • {{Annual Readership double}}
  • {{Pageviews double}}

See also

  • {{Annual readership}}
  • {{Graph:PageViews}} – Use instead, if further variations are desired
The above documentation is transcluded from Template:Page views double/doc. (edit | history)
Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages.
Add categories to the /doc subpage. Subpages of this template.
Retrieved from "https://moasspedia.org/w/index.php?title=Template:Page_views_double&oldid=26562"
Categories:
  • Talk message boxes
  • Templates using TemplateData
  • Wikipedia pageviews
  • Chart, diagram and graph formatting and function templates
Last edited on 21 April 2021, at 18:00

MOASSpedia

Content is available under Creative Commons Attribution-ShareAlike unless otherwise noted.
  • This page was last edited on 21 April 2021, at 18:00.
  • Content is available under Creative Commons Attribution-ShareAlike unless otherwise noted.
  • Privacy policy
  • About MOASSpedia
  • Disclaimers
  • Desktop