Template:Xviews/item bar/doc
This is a documentation subpage for Template:Xviews/item bar. It may contain usage information, categories and other content that is not part of the original template page. |
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 toy
to display bar values to logarithmic scale (default: linear) (not implemented yet)|vert=
– boolean; set toy
to display bars vertically (default: horizontal) (not implemented yet)
Examples
[edit]- 1.
{{xviews/item bar|page=Talk:Cleopatra/pageviews|n=1|max=199068}}
→ - 2.
{{xviews/item bar|page=Talk:World War II/pageviews|n=1|max=59424}}
→
3. first twenty page view stats from pageviews file for Liberation of France
|
---|
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.