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>
{
// // 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/AQS/Pageviews //
"$schema": "https://vega.github.io/schema/vega/v5.json", "width": 800, "height": 200, "autosize": { "type": "fit", "resize": false, "contains": "padding" }, // 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": "https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/www.linuxwebexpert.com/all-access/user/Template%3AGraph%3APageViews/daily/2024112500/2024122500", "format": { "type": "json", "property": "items" },
// The response is parsed here, converting date strings of form "20160223" into date 2016-02-23 "transform": [ { "type": "formula", "as": "year", "expr": "parseInt(substring(datum.timestamp,0,4))" }, { "type": "formula", "as": "month", "expr": "parseInt(substring(datum.timestamp,4,6))" }, { "type": "formula", "as": "day", "expr": "parseInt(substring(datum.timestamp,6,8))" }, { "type": "formula", "as": "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","fields": ["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","fields": ["views"]}, "clamp": true,
"nice": true } ],
// Simple axis with horizontal grid lines "axes": [ { "orient": "bottom", "scale": "x", "tickCount": 5 }, { "orient": "left", "scale": "y", "grid": true, "tickCount": 5 } ],
// 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"}, "encode": { "enter": { "x": {"scale": "x","field": "date"}, "y": {"scale": "y","field": "views"}, "stroke": {"value": "#36c"}, "strokeWidth": {"value": 3}, "interpolate": {"value": "monotone"} } } }, { "type": "area", "from": {"data": "pageviews"}, "encode": { "enter": { "x": {"scale": "x","field": "date"}, "y": {"scale": "y","value": 0}, "y2": {"scale": "y","field": "views"}, "fill": {"value": "#36c"}, "fillOpacity": {"value": 0.35}, "interpolate": {"value": "monotone"} } } } ], "config": { "axis": { "labelColor": "#54595d", "tickColor": "#54595d", "tickWidth": 1.5, "gridColor": "#a2a9b1", "gridOpacity": 0.4, "gridWidth": 2, "domainWidth": 2 } }
} </graph>
- {{ Graph:PageViews | 90 | Main Page | en.wikipedia.org }}
90 days for Main Page on English Wikipedia
- <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/AQS/Pageviews //
"$schema": "https://vega.github.io/schema/vega/v5.json", "width": 800, "height": 200, "autosize": { "type": "fit", "resize": false, "contains": "padding" }, // 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": "https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/en.wikipedia.org/all-access/user/Main%20Page/daily/2024092600/2024122500", "format": { "type": "json", "property": "items" },
// The response is parsed here, converting date strings of form "20160223" into date 2016-02-23 "transform": [ { "type": "formula", "as": "year", "expr": "parseInt(substring(datum.timestamp,0,4))" }, { "type": "formula", "as": "month", "expr": "parseInt(substring(datum.timestamp,4,6))" }, { "type": "formula", "as": "day", "expr": "parseInt(substring(datum.timestamp,6,8))" }, { "type": "formula", "as": "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","fields": ["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","fields": ["views"]}, "clamp": true,
"nice": true } ],
// Simple axis with horizontal grid lines "axes": [ { "orient": "bottom", "scale": "x", "tickCount": 5 }, { "orient": "left", "scale": "y", "grid": true, "tickCount": 5 } ],
// 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"}, "encode": { "enter": { "x": {"scale": "x","field": "date"}, "y": {"scale": "y","field": "views"}, "stroke": {"value": "#36c"}, "strokeWidth": {"value": 3}, "interpolate": {"value": "monotone"} } } }, { "type": "area", "from": {"data": "pageviews"}, "encode": { "enter": { "x": {"scale": "x","field": "date"}, "y": {"scale": "y","value": 0}, "y2": {"scale": "y","field": "views"}, "fill": {"value": "#36c"}, "fillOpacity": {"value": 0.35}, "interpolate": {"value": "monotone"} } } } ], "config": { "axis": { "labelColor": "#54595d", "tickColor": "#54595d", "tickWidth": 1.5, "gridColor": "#a2a9b1", "gridOpacity": 0.4, "gridWidth": 2, "domainWidth": 2 } }
} </graph>
- {{ Graph:PageViews | 180 | _ }}
Monthly visitors to the current wiki (last 6 months)
- <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/AQS/Pageviews //
"$schema": "https://vega.github.io/schema/vega/v5.json", "width": 800, "height": 200, "autosize": { "type": "fit", "resize": false, "contains": "padding" }, // 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": "https://wikimedia.org/api/rest_v1/metrics/pageviews/aggregate/www.linuxwebexpert.com/all-access/user/monthly/2024062800/2024122500", "format": { "type": "json", "property": "items" },
// The response is parsed here, converting date strings of form "20160223" into date 2016-02-23 "transform": [ { "type": "formula", "as": "year", "expr": "parseInt(substring(datum.timestamp,0,4))" }, { "type": "formula", "as": "month", "expr": "parseInt(substring(datum.timestamp,4,6))" }, { "type": "formula", "as": "day", "expr": "parseInt(substring(datum.timestamp,6,8))" }, { "type": "formula", "as": "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","fields": ["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","fields": ["views"]}, "clamp": true,
"nice": true } ],
// Simple axis with horizontal grid lines "axes": [ { "orient": "bottom", "scale": "x", "tickCount": 5 }, { "orient": "left", "scale": "y", "grid": true, "tickCount": 5 } ],
// 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"}, "encode": { "enter": { "x": {"scale": "x","field": "date"}, "y": {"scale": "y","field": "views"}, "stroke": {"value": "#36c"}, "strokeWidth": {"value": 3}, "interpolate": {"value": "monotone"} } } }, { "type": "area", "from": {"data": "pageviews"}, "encode": { "enter": { "x": {"scale": "x","field": "date"}, "y": {"scale": "y","value": 0}, "y2": {"scale": "y","field": "views"}, "fill": {"value": "#36c"}, "fillOpacity": {"value": 0.35}, "interpolate": {"value": "monotone"} } } } ], "config": { "axis": { "labelColor": "#54595d", "tickColor": "#54595d", "tickWidth": 1.5, "gridColor": "#a2a9b1", "gridOpacity": 0.4, "gridWidth": 2, "domainWidth": 2 } }
} </graph>
- {{ Graph:PageViews | 180 | _ | all-projects | granularity = daily }}
Daily visitors to all worldwide wikis (last 6 months)
- <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/AQS/Pageviews //
"$schema": "https://vega.github.io/schema/vega/v5.json", "width": 800, "height": 200, "autosize": { "type": "fit", "resize": false, "contains": "padding" }, // 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": "https://wikimedia.org/api/rest_v1/metrics/pageviews/aggregate/all-projects/all-access/user/daily/2024062800/2024122500", "format": { "type": "json", "property": "items" },
// The response is parsed here, converting date strings of form "20160223" into date 2016-02-23 "transform": [ { "type": "formula", "as": "year", "expr": "parseInt(substring(datum.timestamp,0,4))" }, { "type": "formula", "as": "month", "expr": "parseInt(substring(datum.timestamp,4,6))" }, { "type": "formula", "as": "day", "expr": "parseInt(substring(datum.timestamp,6,8))" }, { "type": "formula", "as": "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","fields": ["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","fields": ["views"]}, "clamp": true,
"nice": true } ],
// Simple axis with horizontal grid lines "axes": [ { "orient": "bottom", "scale": "x", "tickCount": 5 }, { "orient": "left", "scale": "y", "grid": true, "tickCount": 5 } ],
// 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"}, "encode": { "enter": { "x": {"scale": "x","field": "date"}, "y": {"scale": "y","field": "views"}, "stroke": {"value": "#36c"}, "strokeWidth": {"value": 3}, "interpolate": {"value": "monotone"} } } }, { "type": "area", "from": {"data": "pageviews"}, "encode": { "enter": { "x": {"scale": "x","field": "date"}, "y": {"scale": "y","value": 0}, "y2": {"scale": "y","field": "views"}, "fill": {"value": "#36c"}, "fillOpacity": {"value": 0.35}, "interpolate": {"value": "monotone"} } } } ], "config": { "axis": { "labelColor": "#54595d", "tickColor": "#54595d", "tickWidth": 1.5, "gridColor": "#a2a9b1", "gridOpacity": 0.4, "gridWidth": 2, "domainWidth": 2 } }
} </graph>
- {{ Graph:PageViews | 30 | Main Page | en.wikipedia.org}}
30 days for Main Page on English Wikipedia
- <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/AQS/Pageviews //
"$schema": "https://vega.github.io/schema/vega/v5.json", "width": 800, "height": 200, "autosize": { "type": "fit", "resize": false, "contains": "padding" }, // 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": "https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/en.wikipedia.org/all-access/user/Main%20Page/daily/2024112500/2024122500", "format": { "type": "json", "property": "items" },
// The response is parsed here, converting date strings of form "20160223" into date 2016-02-23 "transform": [ { "type": "formula", "as": "year", "expr": "parseInt(substring(datum.timestamp,0,4))" }, { "type": "formula", "as": "month", "expr": "parseInt(substring(datum.timestamp,4,6))" }, { "type": "formula", "as": "day", "expr": "parseInt(substring(datum.timestamp,6,8))" }, { "type": "formula", "as": "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","fields": ["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","fields": ["views"]}, "clamp": true,
"nice": true } ],
// Simple axis with horizontal grid lines "axes": [ { "orient": "bottom", "scale": "x", "tickCount": 5 }, { "orient": "left", "scale": "y", "grid": true, "tickCount": 5 } ],
// 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"}, "encode": { "enter": { "x": {"scale": "x","field": "date"}, "y": {"scale": "y","field": "views"}, "stroke": {"value": "#36c"}, "strokeWidth": {"value": 3}, "interpolate": {"value": "monotone"} } } }, { "type": "area", "from": {"data": "pageviews"}, "encode": { "enter": { "x": {"scale": "x","field": "date"}, "y": {"scale": "y","value": 0}, "y2": {"scale": "y","field": "views"}, "fill": {"value": "#36c"}, "fillOpacity": {"value": 0.35}, "interpolate": {"value": "monotone"} } } } ], "config": { "axis": { "labelColor": "#54595d", "tickColor": "#54595d", "tickWidth": 1.5, "gridColor": "#a2a9b1", "gridOpacity": 0.4, "gridWidth": 2, "domainWidth": 2 } }
} </graph>
- {{ Graph:PageViews | 30 | Main Page | en.wikipedia.org | platform = desktop}}
30 days for Main Page on English Wikipedia - desktop computer browsers
- <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/AQS/Pageviews //
"$schema": "https://vega.github.io/schema/vega/v5.json", "width": 800, "height": 200, "autosize": { "type": "fit", "resize": false, "contains": "padding" }, // 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": "https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/en.wikipedia.org/desktop/user/Main%20Page/daily/2024112500/2024122500", "format": { "type": "json", "property": "items" },
// The response is parsed here, converting date strings of form "20160223" into date 2016-02-23 "transform": [ { "type": "formula", "as": "year", "expr": "parseInt(substring(datum.timestamp,0,4))" }, { "type": "formula", "as": "month", "expr": "parseInt(substring(datum.timestamp,4,6))" }, { "type": "formula", "as": "day", "expr": "parseInt(substring(datum.timestamp,6,8))" }, { "type": "formula", "as": "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","fields": ["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","fields": ["views"]}, "clamp": true,
"nice": true } ],
// Simple axis with horizontal grid lines "axes": [ { "orient": "bottom", "scale": "x", "tickCount": 5 }, { "orient": "left", "scale": "y", "grid": true, "tickCount": 5 } ],
// 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"}, "encode": { "enter": { "x": {"scale": "x","field": "date"}, "y": {"scale": "y","field": "views"}, "stroke": {"value": "#36c"}, "strokeWidth": {"value": 3}, "interpolate": {"value": "monotone"} } } }, { "type": "area", "from": {"data": "pageviews"}, "encode": { "enter": { "x": {"scale": "x","field": "date"}, "y": {"scale": "y","value": 0}, "y2": {"scale": "y","field": "views"}, "fill": {"value": "#36c"}, "fillOpacity": {"value": 0.35}, "interpolate": {"value": "monotone"} } } } ], "config": { "axis": { "labelColor": "#54595d", "tickColor": "#54595d", "tickWidth": 1.5, "gridColor": "#a2a9b1", "gridOpacity": 0.4, "gridWidth": 2, "domainWidth": 2 } }
} </graph>
- {{ Graph:PageViews | 30 | Main Page | en.wikipedia.org | platform = mobile-web}}
30 days for Main Page on English Wikipedia - mobile browsers
- <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/AQS/Pageviews //
"$schema": "https://vega.github.io/schema/vega/v5.json", "width": 800, "height": 200, "autosize": { "type": "fit", "resize": false, "contains": "padding" }, // 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": "https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/en.wikipedia.org/mobile-web/user/Main%20Page/daily/2024112500/2024122500", "format": { "type": "json", "property": "items" },
// The response is parsed here, converting date strings of form "20160223" into date 2016-02-23 "transform": [ { "type": "formula", "as": "year", "expr": "parseInt(substring(datum.timestamp,0,4))" }, { "type": "formula", "as": "month", "expr": "parseInt(substring(datum.timestamp,4,6))" }, { "type": "formula", "as": "day", "expr": "parseInt(substring(datum.timestamp,6,8))" }, { "type": "formula", "as": "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","fields": ["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","fields": ["views"]}, "clamp": true,
"nice": true } ],
// Simple axis with horizontal grid lines "axes": [ { "orient": "bottom", "scale": "x", "tickCount": 5 }, { "orient": "left", "scale": "y", "grid": true, "tickCount": 5 } ],
// 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"}, "encode": { "enter": { "x": {"scale": "x","field": "date"}, "y": {"scale": "y","field": "views"}, "stroke": {"value": "#36c"}, "strokeWidth": {"value": 3}, "interpolate": {"value": "monotone"} } } }, { "type": "area", "from": {"data": "pageviews"}, "encode": { "enter": { "x": {"scale": "x","field": "date"}, "y": {"scale": "y","value": 0}, "y2": {"scale": "y","field": "views"}, "fill": {"value": "#36c"}, "fillOpacity": {"value": 0.35}, "interpolate": {"value": "monotone"} } } } ], "config": { "axis": { "labelColor": "#54595d", "tickColor": "#54595d", "tickWidth": 1.5, "gridColor": "#a2a9b1", "gridOpacity": 0.4, "gridWidth": 2, "domainWidth": 2 } }
} </graph>
- {{ Graph:PageViews | 30 | Main Page | en.wikipedia.org | platform = mobile-app}}
30 days for Main Page on English Wikipedia - mobile applications
- <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/AQS/Pageviews //
"$schema": "https://vega.github.io/schema/vega/v5.json", "width": 800, "height": 200, "autosize": { "type": "fit", "resize": false, "contains": "padding" }, // 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": "https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/en.wikipedia.org/mobile-app/user/Main%20Page/daily/2024112500/2024122500", "format": { "type": "json", "property": "items" },
// The response is parsed here, converting date strings of form "20160223" into date 2016-02-23 "transform": [ { "type": "formula", "as": "year", "expr": "parseInt(substring(datum.timestamp,0,4))" }, { "type": "formula", "as": "month", "expr": "parseInt(substring(datum.timestamp,4,6))" }, { "type": "formula", "as": "day", "expr": "parseInt(substring(datum.timestamp,6,8))" }, { "type": "formula", "as": "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","fields": ["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","fields": ["views"]}, "clamp": true,
"nice": true } ],
// Simple axis with horizontal grid lines "axes": [ { "orient": "bottom", "scale": "x", "tickCount": 5 }, { "orient": "left", "scale": "y", "grid": true, "tickCount": 5 } ],
// 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"}, "encode": { "enter": { "x": {"scale": "x","field": "date"}, "y": {"scale": "y","field": "views"}, "stroke": {"value": "#36c"}, "strokeWidth": {"value": 3}, "interpolate": {"value": "monotone"} } } }, { "type": "area", "from": {"data": "pageviews"}, "encode": { "enter": { "x": {"scale": "x","field": "date"}, "y": {"scale": "y","value": 0}, "y2": {"scale": "y","field": "views"}, "fill": {"value": "#36c"}, "fillOpacity": {"value": 0.35}, "interpolate": {"value": "monotone"} } } } ], "config": { "axis": { "labelColor": "#54595d", "tickColor": "#54595d", "tickWidth": 1.5, "gridColor": "#a2a9b1", "gridOpacity": 0.4, "gridWidth": 2, "domainWidth": 2 } }
} </graph>
- {{ Graph:PageViews | 30 | Main Page | en.wikipedia.org | agent = spider}}
30 days for Main Page on English Wikipedia - 'spider' agent
- <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/AQS/Pageviews //
"$schema": "https://vega.github.io/schema/vega/v5.json", "width": 800, "height": 200, "autosize": { "type": "fit", "resize": false, "contains": "padding" }, // 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": "https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/en.wikipedia.org/all-access/spider/Main%20Page/daily/2024112500/2024122500", "format": { "type": "json", "property": "items" },
// The response is parsed here, converting date strings of form "20160223" into date 2016-02-23 "transform": [ { "type": "formula", "as": "year", "expr": "parseInt(substring(datum.timestamp,0,4))" }, { "type": "formula", "as": "month", "expr": "parseInt(substring(datum.timestamp,4,6))" }, { "type": "formula", "as": "day", "expr": "parseInt(substring(datum.timestamp,6,8))" }, { "type": "formula", "as": "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","fields": ["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","fields": ["views"]}, "clamp": true,
"nice": true } ],
// Simple axis with horizontal grid lines "axes": [ { "orient": "bottom", "scale": "x", "tickCount": 5 }, { "orient": "left", "scale": "y", "grid": true, "tickCount": 5 } ],
// 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"}, "encode": { "enter": { "x": {"scale": "x","field": "date"}, "y": {"scale": "y","field": "views"}, "stroke": {"value": "#36c"}, "strokeWidth": {"value": 3}, "interpolate": {"value": "monotone"} } } }, { "type": "area", "from": {"data": "pageviews"}, "encode": { "enter": { "x": {"scale": "x","field": "date"}, "y": {"scale": "y","value": 0}, "y2": {"scale": "y","field": "views"}, "fill": {"value": "#36c"}, "fillOpacity": {"value": 0.35}, "interpolate": {"value": "monotone"} } } } ], "config": { "axis": { "labelColor": "#54595d", "tickColor": "#54595d", "tickWidth": 1.5, "gridColor": "#a2a9b1", "gridOpacity": 0.4, "gridWidth": 2, "domainWidth": 2 } }
} </graph>
Template may be used with different parameter order. For example, in English Wikipedia
{{Graph:PageViews|90|Main Page}}
{{Graph:PageViews|Main Page|90}}
{{Graph:PageViews|Main Page|en.wikipedia.org|90}}
will give the same output.
TemplateData
<templatedata> { "params": { "1": { "type": "number", "default": "30", "label": { "en": "Number of days back", "fr": "Nombre de jours", "hu": "Napok száma", "he": "מספר ימים אחורה", "no": "Antall dager bakover" }, "description": { "en": "Number of days back to show in the chart", "fr": "Nombre de jours à montrer sur le graphique", "hu": "A grafikonon megjelenítendő legutóbbi napok száma", "he": "מספר ימים אחורה להצגת המידע" } }, "2": { "label": { "en": "Page Title", "fr": "Titre de la page", "hu": "Lapcím", "he": "דף", "no": "Artikkelnavn" }, "description": { "en": "Title of the page, with namespace, including needed spaces. If '_' is given, shows the total for the whole site", "fr": "Titre de la page, avec l'espace de nom, incluant d'éventuels espaces si nécessaire. Si '_' est passé, montre le total pour l'ensemble du site", "hu": "A lap címe névtérrel és megfelelő szóközökkel. Ha az értéke „_”, akkor az egész wikire vonatkozóan jeleníti meg a statisztikát.", "he": "שם הדף. הצבת '_' נותנת מידע על כל הדפים בוויקיפדיה יחד", "no": "Artikkelnavnet, med navnerom og eventuelle nødvendige mellomrom" }, "type": "wiki-page-name", "default": { "en": "Name of the current article page (even if on talk page)", "fr": "Nom de l'article courant (même si posé sur une page de discussion)", "hu": "Az aktuális laphoz tartozó tartalmi lap címe (szócikk címe a vitalapján is)", "he": "הדף הנוכחי (בדף השיחה מוצג מידע על דף התוכן התואם)", "no": "Navnet på inneværende artikkel (selv om det er på en diskusjonsside)" }, "example": { "en": "Main Page", "fr": "Main Page", "hu": "Kezdőlap", "he": "ויקיפדיה:מזנון", "no": "Main Page" } }, "3": { "label": { "en": "Domain", "fr": "Domaine", "hu": "wiki", "he": "אתר", "no": "Domene" }, "default": { "en": "Current wiki", "fr": "Wiki actuel", "hu": "aktuális wiki", "he": "ויקיפדיה העברית", "no": "Denne wiki" }, "example": "en.wikipedia.org", "type": "line", "description": { "en": "Domain from which to find page views for the given title, if not this wiki. If '_' is given as parameter 2, 'all-projects' can be used here for all wiki sites summary data", "fr": "Domaine à partir duquel trouver les statistiques de visualisation de pages pour le titre donné, si ce n'est pas sur le wiki courant. Si '_' est passé en second paramètre, 'all-projects' peut être utilisé pour obtenir les données de tous les wikis.", "hu": "A lekérdezendő wiki domainneve (ha nem az aktuális). Ha a második paraméter „_”, akkor lehet „all-projects” az összes wiki összefoglaló adatainak megjelenítéséhez", "he": "אתר ויקי בו נמצא הדף, אם לא בוויקיעברית. במידה והפרמטר השני הוא '_', ניתן להשתמש בפרמטר הזה בערך 'all-projects' כדי לראות סיכום של כל אתרי ויקי בעולם" } }, "color": { "label": { "en": "Graph color", "fr": "Couleur du graph", "hu": "Grafikon színe", "he": "צבע הגרף", "no": "Graf-farge" }, "default": "#00f", "example": "#f00", "type": "line", "description": { "en": "Shade with which to highlight the data in the chart", "fr": "Couleur avec laquelle mettre en avant les données dans le graph", "hu": "A grafikon vonalának a színe", "he": "צבע המידע בגרף" } }, "scale": { "label": { "en": "Graph scale", "fr": "Échelle du graph", "hu": "Grafikon skálázása", "he": "סולם מדידה", "no": "Skala" }, "description": { "en": "Scaling could be one of these: linear, log, pow, sqrt, quantile, quantize, and threshold", "fr": "L'échelle peut être l'une de celles-ci : linear, log, pow, sqrt, quantile, quantize et threshold", "hu": "A skálázás a következők egyike lehet: linear, log, pow, sqrt, quantile, quantize és threshold", "he": "אחד מאלו: linear, log, pow, sqrt, quantile, quantize, threshold", "no": "Skalaen kan være en av disse: linear, log, pow, sqrt, quantile, quantize, og threshold" }, "default": "linear", "example": "log", "type": "line" }, "max": { "label": { "en": "Maximum Y value axis", "fr": "Valeur maximum de l'axe Y", "hu": "Y tengely maximuma", "he": "ערך Y מקסימלי", "no": "maksimumsverdi på Y-aksen" }, "description": { "en": "This optional value might be useful to align multiple graphs side-by-side", "fr": "Cette valeur optionnelle peut être utile pour aligner plusieurs graphs côte-à-côte", "hu": "Az y tengely méretének korlátozása, több grafikon összehasonlításakor lehet praktikus", "he": "הערך המקסימלי של ציר Y, כדי לשים כמה גרפים אחד ליד השני להשוואה באותו גובה", "no": "Denne valgfrie verdien kan benyttes for å justere flere grafer ved siden av hverandre" }, "default": { "en": "Automatically scaled to the data.", "fr": "Mise à l'échelle automatique des données", "hu": "Az adatoktól függő", "he": "לפי המידע בגרף" }, "example": "10000", "type": "number" }, "width": { "label": { "en": "Width", "fr": "Largeur", "hu": "Szélesség", "he": "רוחב", "no": "Bredde" }, "description": { "en": "Width for the chart in pixels, if different from the default.", "fr": "Largeur du graph en pixels, si différente de la valeur par défaut", "hu": "A diagram szélessége képpontban", "he": "רוחב הגרף בפיקסלים, אם שונה מברירת מחדל" }, "type": "number", "default": "800" }, "height": { "label": { "en": "Height", "fr": "Hauteur", "hu": "Magasság", "he": "גובה", "no": "Høyde" }, "description": { "en": "Height for the chart in pixels, if different from the default.", "fr": "Hauteur du graph en pixels, si différente de la valeur par défaut", "hu": "A grafikon magassága képpontban", "he": "גובה הגרף בפיקסלים, אם שונה מברירת מחדל" }, "type": "number", "default": "200" }, "platform": { "label": { "en": "Platform", "fr": "Plateforme", "hu": "Platform", "he": "פלטפורמה", "no": "Platform" }, "description": { "en": "Computer platform could be one of these: all-access (all platforms together), desktop (regular browsers), mobile-web (mobile browsers), mobile-app (mobile wiki applications)", "fr": "Type de la plateforme utilisée pour accéder au wiki : all-access (toutes les plateformes réunies), desktop (navigateur web standard), mobile-web (navigateur web sur mobile), mobile-app (application mobile)", "hu": "Platform, az alábbiak egyike: „all-access” (minden platform), „desktop” (asztali számítógépek böngészői), „mobile-web” (mobil eszközök böngészői) és „mobile-app” (mobil eszközökön futó Wikipédia-alkalmazások)", "he": "פלטפורמת מחשב, אחת מאלו: all-access (כולן ביחד), desktop (דפדפנים רגילים), mobile-web (דפדפנים בניידים), mobile-app (אפליקציות ויקי בניידים)" }, "type": "line", "default": "all-access" }, "granularity": { "label": { "en": "Granularity", "fr": "Granularité", "hu": "Részletesség", "he": "יחידות" }, "description": { "en": "If the 2nd parameter is '_' (shows site stats), set data granularity monthly, daily, or hourly", "fr": "Si le second paramètre est '_' (montrant les statistiques globales du wiki), définit la granularité des données : monthly (mensuel), daily (journalier), hourly (horaire)", "hu": "Ha a második paraméter „_” (teljes wiki statisztikái), az adatok pontossága: „monthly” (havi), „daily” (napi) vagy „hourly” (óránkénti)", "he": "אם הפרמטר השני הוא '_', ניתן לבחור בין daily ,monthly, או hourly" }, "type": "line", "default": "monthly" }, "interpolate": { "description": "Type of line interpolation. See https://vega.github.io/vega/docs/marks/line/", "type": "line", "default": "monotone", "suggestedvalues": [ "linear", "monotone", "basis", "bundle", "cardinal", "catmull-rom", "natural", "step", "step-before", "step-after" ], "label": "Interpolate" }, "agent": { "label": "Agent", "description": "If you want to filter by agent type, use one of user, automated or spider. If you are interested in pageviews regardless of agent type, use all-agents.", "type": "line", "suggestedvalues": [ "user", "spider", "automated", "all-agents" ], "default": "user" } }, "paramOrder": [ "1", "2", "3", "agent", "color", "scale", "max", "width", "height", "platform", "granularity", "interpolate" ], "format": "block", "description": { "en": "Inserts a graph with the page views statistics for the past N days of a page.", "fr": "Insère un graph représentant les statistiques de consultation d'une page pour les N derniers jours.", "hu": "Beilleszt egy grafikont egy lap utóbbi N napra vonatkozó nézettségi statisztikájával.", "he": "מציגה גרף צפיות לדף מסוים או לכל הדפים" } } </templatedata>
<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/AQS/Pageviews
//
"$schema": "https://vega.github.io/schema/vega/v5.json",
"width": 800,
"height": 200,
"autosize": {
"type": "fit",
"resize": false,
"contains": "padding"
},
// 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": "https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/www.linuxwebexpert.com/all-access/user/Template%3AGraph%3APageViews/daily/2024112500/2024122500",
"format": {
"type": "json",
"property": "items"
},
// The response is parsed here, converting date strings of form "20160223" into date 2016-02-23
"transform": [
{ "type": "formula", "as": "year", "expr": "parseInt(substring(datum.timestamp,0,4))" },
{ "type": "formula", "as": "month", "expr": "parseInt(substring(datum.timestamp,4,6))" },
{ "type": "formula", "as": "day", "expr": "parseInt(substring(datum.timestamp,6,8))" },
{ "type": "formula", "as": "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","fields": ["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","fields": ["views"]},
"clamp": true,
"nice": true
}
],
// Simple axis with horizontal grid lines
"axes": [
{
"orient": "bottom",
"scale": "x",
"tickCount": 5
},
{
"orient": "left",
"scale": "y",
"grid": true,
"tickCount": 5
}
],
// 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"},
"encode": {
"enter": {
"x": {"scale": "x","field": "date"},
"y": {"scale": "y","field": "views"},
"stroke": {"value": "#36c"},
"strokeWidth": {"value": 3},
"interpolate": {"value": "monotone"}
}
}
},
{
"type": "area",
"from": {"data": "pageviews"},
"encode": {
"enter": {
"x": {"scale": "x","field": "date"},
"y": {"scale": "y","value": 0},
"y2": {"scale": "y","field": "views"},
"fill": {"value": "#36c"},
"fillOpacity": {"value": 0.35},
"interpolate": {"value": "monotone"}
}
}
}
],
"config": {
"axis": {
"labelColor": "#54595d",
"tickColor": "#54595d",
"tickWidth": 1.5,
"gridColor": "#a2a9b1",
"gridOpacity": 0.4,
"gridWidth": 2,
"domainWidth": 2
}
}
}
</graph>