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
06-23421
06-24395
06-25481
06-26421
06-27365
06-28361
06-29388
06-30403
07-01445
07-02359
07-03436
07-04415
07-05361
07-06366
07-07487
07-08500
07-09506
07-10374
07-11368
07-12347

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.