Jump to content

Template talk:Xviews

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

List of templates

[edit]

{{Xreadership}} is the top-level tmbox (talk page message box) destined for the Talk page, and is a temporary replacement for {{annual readership}}. It calls {{xviews}} and {{xviews/summary}}.

Subtemplates of {{Xviews}} include the following:

  • {{xviews/xvmain}}, main loop that calls item bar once for each page view statistic in the file
  • {{xviews/age}}, returns the age in days of the most recent statistic in the given pageviews file
  • {{xviews/item bar}}, emits one progress bar-style graphic corresponding to a given line number of a pageviews file
  • {{xviews/vbar}}, generates a single page views bar, currently horizontal only
  • {{xviews/max views}}, return the maximum value from downloaded pageviews data.
  • {{xviews/min views}}, return the minimum value from downloaded pageviews data.
  • {{xviews/first date}}, return the first (oldest) date in the pageviews file.
  • {{xviews/last date}}, return the last (most recent) date in the pageviews file.
  • {{xviews/view count}}, return the count of page view statistics in downloaded pageviews data
  • {{xviews/nth view}}, returns the nth view item (date:value) from downloaded pageviews data.
  • {{xviews/xlabel}}, returns a normalized form of the date for bar identification; currently, just drops the year.
  • {{xviews/x-axis}}, generates an x-axis legend with labeled tick marks for a horizontal page views chart
  • {{xviews/summary}}, generates a summary string containing six statistics about the pageviews file.
  • {{xviews/pvstatus}}, returns the status of a pageviews file: missing, aging, stale, or empty for good status.

Pseudo-globals:

  • gSTALE ({{xviews/gSTALE}} = 30) – the age in days after which a pageviews file, and any chart based on it, becomes stale and no longer appropriate for display on a Talk page
  • gINTERVAL ({{xviews/gCOUNT}} = 75) – default number of days to display; normally 92 (3 months)
  • gAGING ({{Xviews/gAGING}} = 7) – value after which the pageviews file is listed for update needed

To-do

[edit]
  • staleness — doesn't belong in Xviews; move to Xreadership instead. Xviews should always display what you ask for. Mathglot (talk) 21:14, 13 September 2024 (UTC)[reply]
    •  Partly done – now in Xreadership.
  • constants – better "globals" handling; some constants referred to in more than one place should probably be stub templates that just return the value; e.g., default staleness threshold; days default; days max; ff (to prevent wrapping).
    •  Partly done – max_views, min_views, view_count. May need ff (see x-axis ticks).
  • max view issue – return max of view statistic of displayed bars, not max of all view stats in the file
  • longest bar calc – the current mix of some CSS values denominated in ch and some in % needs improvement.
    • Or, leave bar length alone, but do something else with the max value, like place inside the bar? Or pop up on hover?
  • x-axis tick placement – the calc for placement of ticks needs to be adjusted by the same ff that is used to keep the longest bar from overflowing.
  • view amount display – do something with long values; e.g., 123.4k instead of 123,456; ditto millions. Pop up full value on hover.
  • TemplateStyles – {{Xreadership}} uses in-line style; should it be moved to TemplateStyles? What do other Tmboxes do?
    • Yes, and use class box-Xreadership, per this; t.b.d.
  • upgrades: add support for log values; vertical mode.
  • edit notice-based instructions; in progress at {{Xreadership/New pageviews instructions}}.
  • rename param ct to days to align better with Xreadership, have one less alias, and simplify the doc.
  • mobile – tmbox already suppressed; anything else?

Mathglot (talk) 21:14, 13 September 2024 (UTC)[reply]

Some updates interpolated above as indented, unsigned additions. Mathglot (talk) 22:34, 23 September 2024 (UTC) More updates added above without individual sigs. Mathglot (talk) 03:22, 29 September 2024 (UTC) Several more.Mathglot (talk) 19:46, 29 September 2024 (UTC)[reply]

Bugs and issues

[edit]
Talk:Brewing in Oregon
06-164
06-1711
06-1815
06-197
06-207
06-219
06-2213
06-2313
06-2432
06-255
06-2612
06-279
06-287
06-2910
06-307
07-017
07-0211
07-0312
07-047
07-0510
07-0610
07-075
07-0810
07-0911
07-103
07-1115
07-129
07-138
07-1410
07-1510
07-166
07-179
07-189
07-1913
07-206
07-2112
07-2212
07-2310
07-249
07-256
07-264
07-2710
07-289
07-299
07-307
07-3111
08-017
08-0210
08-0313
08-047
08-059
08-067
08-0717
08-086
08-0910
08-1014
08-119
08-123
08-1312
08-149
08-1513
08-1610
08-1712
08-1812
08-197
08-207
08-2116
08-2216
08-238
08-2416
08-258
08-267
08-2713
08-2818
08-296
08-3013
08-312
09-0113
09-025
09-0310
09-048
09-0514
09-0610
09-0713
09-0811
09-0913
09-107
09-112
09-127
09-139
page views for Brewing in Oregon

.

Note: max=32, so bar length is okay; here is Talk:Brewing in Oregon/pageviews. Mathglot (talk) 08:42, 14 September 2024 (UTC)[reply]

Robustness enhancement: data title

[edit]

The download has the pagename in it. When Xviews is launched on the default page, it should read the page title in the download, and if it does not agree with Template:Xviews, an error message should be emitted, and no chart displayed, to guard against a download file being copied to the wrong destination page. Mathglot (talk) 08:51, 15 September 2024 (UTC)[reply]

Enhanced summary

[edit]

For an enhanced summary display, add new subtemplates to extract the first and last dates from pageviews; then we can alter */summary to produce a more informative and user-friendly message, like 'Page views from <start> to <end-date> ...' etc. Mathglot (talk) 22:35, 23 September 2024 (UTC)[reply]

Sandbox now has this, but there's an issue about whether param1 should be the page name with, or without, the /pageviews sufffix. Part of the issue is linking the download file from toolforge, which needs the {{SUBJECTPAGENAME}} without the /pageviews suffix, and if param1 is defined with it, then it has to be stripped first, and if it isn't, then either we need another param (ugh!) or we just assume that the pageviews file is always a subpage with the name /pageviews, which hasn't been the assumption so far. Mathglot (talk) 02:31, 25 September 2024 (UTC)[reply]

Deprecate ct

[edit]

I think old param alias |ct= for param 2 (days) has now been removed from the wild, so it can be removed from the code once that has been fully tested. Mathglot (talk) 21:33, 28 September 2024 (UTC)[reply]

Done in the wild (check); still persists in some subtemplates, i.e., {{Xviews/xvmain}}. Mathglot (talk) 19:38, 29 September 2024 (UTC)[reply]