Jump to content

Template:Xviews/item bar/doc

From Wikipedia, the free encyclopedia

Emits one progress bar-style graphic corresponding to a given line number of a pageviews file downloaded from the pageviews tool.

Usage

[edit]
{{xviews/item bar|page=Talk:ArticleName/pageviews|n=number|max=maximum view count}}

Parameters

[edit]

Data params

There are three required named parameters:

  • |page= – a page views dump file downloaded from the pageviews tool
  • |n= – a number indicating which page views statistic to plot. Note that this is not line number, because of the column headers, the first statistic is on line two of the file, the second on line three, and so on.
  • |max= – the largest page views value in the given page views page named in param 1; this is used to calculate a maximum bar length against which the others are sized to scale. (There is one known issue in connection with this.)

And two optional configuration params:

  • |log= – boolean; set to y to display bar values to logarithmic scale (default: linear) (not implemented yet)
  • |vert= – boolean; set to y to display bars vertically (default: horizontal) (not implemented yet)

Examples

[edit]
1. {{xviews/item bar|page=Talk:Cleopatra/pageviews|n=1|max=199068}}
07-25141200
2. {{xviews/item bar|page=Talk:World War II/pageviews|n=1|max=59424}}
07-0930296
3. first twenty page view stats from pageviews file for Liberation of France
09-28301
09-29258
09-30270
10-01308
10-02264
10-03249
10-04218
10-05228
10-06258
10-07315
10-08278
10-09275
10-10280
10-11265
10-12257
10-13250
10-14293
10-15347
10-16301
10-17319

Notes

[edit]

Known issues

[edit]

A missing pageviews data file will result in inelegant failure of the template with uncaught errors. This due to no check being made for the existence of the pageviews file. This is as designed, because this subtemplate is not designed for direct user access, and since the no-pageviews file case is already trapped at a higher level, there is no need to duplicate that test here.

Page view values near the maximum value in the download file may wrap onto a second line for some screen widths. The maximum bar should not be 100% width, but 100% minus a sufficient amount to accommodate the date field on the left, and the page views field on the right. This is partially rectified with a 88% fudge factor in the code (calculated, not hand-wavy), but the calculation is optimized for full screen width, and fails for narrower widths, and also for values greater than 999,999, so it needs to be refined.