Template:property statistics: Difference between revisions

From Thesaurus Inscriptionum Raeticarum
Jump to navigationJump to search
No edit summary
 
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 23: Line 23:
   | {{ #ifexpr: {{ #var: i }} < {{#var: stop }} | true }}
   | {{ #ifexpr: {{ #var: i }} < {{#var: stop }} | true }}
   |<nowiki/>{{#vardefine: i | {{ #expr: {{ #var: i }} + {{#var: step }} }} }}{{#vardefine: values | {{#var: values }}, {{ #var: i }} }} }} }}{{#vardefine: values | {{#replace: {{#var: values }}|, |,}} }}{{#vardefine: all | {{#ask:[[Category:{{#var: category }}]][[{{#var: property }}::+]]|format=count}} }}
   |<nowiki/>{{#vardefine: i | {{ #expr: {{ #var: i }} + {{#var: step }} }} }}{{#vardefine: values | {{#var: values }}, {{ #var: i }} }} }} }}{{#vardefine: values | {{#replace: {{#var: values }}|, |,}} }}{{#vardefine: all | {{#ask:[[Category:{{#var: category }}]][[{{#var: property }}::+]]|format=count}} }}
Number of pages in the [[:Category:{{#var: category }}]] ({{#var: all}}) per "{{#var: property }}":
{{#ifeq: {{#var: all}}|0|none|Number of pages in the [[:Category:{{#var: category }}]] ({{#var: all}}) per "{{#var: property }}":
{| class="table_lines" width={{var|image_width}}
{{{!}} class="table_lines" width={{var|image_width}}
! width="*" | {{#var: property }}
! width="*" {{!}} {{#var: property }}
! occurrence
! occurrence
! colspan="3" | &nbsp;
! colspan="3" {{!}} &nbsp;
|- {{#vardefine: i | 0 }}{{#vardefine: ok | 1 }}{{ #while:
{{!}}- {{#vardefine: i | 0 }}{{#vardefine: ok | 1 }}{{ #while:
   | {{ #ifexpr: {{ #var: ok }} = 1 | true }}
   | {{ #ifexpr: {{ #var: ok }} = 1 | true }}
   |<nowiki/>
   |<nowiki/>
Line 38: Line 38:
{{!}} style="text-align:right;" {{!}}{{#var: n }}{{#vardefine: n_values | {{#expr: {{#var: n_values }} + {{#var: n }} }} }}
{{!}} style="text-align:right;" {{!}}{{#var: n }}{{#vardefine: n_values | {{#expr: {{#var: n_values }} + {{#var: n }} }} }}
{{!}} style="text-align:right;" {{!}}{{#vardefine: percent | {{#expr: {{#var: n }} / {{#var: all }} / 100 }} }}{{#vardefine: pmax | {{ #expr: {{ #var: pmax }} + {{#var: percent }} }} }}{{percent|{{#var: n }}|{{#var: all }}}}
{{!}} style="text-align:right;" {{!}}{{#vardefine: percent | {{#expr: {{#var: n }} / {{#var: all }} / 100 }} }}{{#vardefine: pmax | {{ #expr: {{ #var: pmax }} + {{#var: percent }} }} }}{{percent|{{#var: n }}|{{#var: all }}}}
{{!}} {{#ifeq: {{#var: n}}|1|{{#ifeq: {{{5|}}}|range|[[{{#ask:[[Category:{{#var: category }}]][[{{#var: property }}::>{{#var: entry }}]][[{{#var: property }}::<{{#var: span }}]]|mainlabel=-|?#-|format=list}}|show&nbsp;page]]|[[{{#ask:[[Category:{{#var: category }}]][[{{#var: property }}::{{#var: entry }}]]|mainlabel=-|?#-|format=list}}|show&nbsp;page]]}}|{{#ifeq: {{{5|}}}|range|{{#ask:[[Category:{{#var: category }}]][[{{#var: property }}::>{{#var: entry }}]][[{{#var: property }}::<{{#var: span }}]]|mainlabel={{#var: category }}|?{{#var: property }}|sort=sortform|format=table|limit=0|searchlabel=show&nbsp;list|default=&nbsp;}}|{{#ask:[[Category:{{#var: category }}]][[{{#var: property }}::{{#var: entry }}]]|mainlabel={{#var: category }}|?{{#var: property }}|sort=sortform|format=table|limit=0|searchlabel=show&nbsp;list|default=&nbsp;}} }} }} }}{{#vardefine: i | {{ #expr: {{ #var: i }} + 1 }} }} }}
{{!}} {{#ifeq: {{#var: n}}|1|{{#ifeq: {{{5|}}}|range|[[{{#ask:[[Category:{{#var: category }}]][[{{#var: property }}::>{{#var: entry }}]][[{{#var: property }}::<{{#var: span }}]]|mainlabel=-|?#-|format=list}}|show&nbsp;page]]|[[{{#ask:[[Category:{{#var: category }}]][[{{#var: property }}::{{#var: entry }}]]|mainlabel=-|?#-|format=list}}|show&nbsp;page]]}}|{{#ifeq: {{{5|}}}|range|{{#ask:[[Category:{{#var: category }}]][[{{#var: property }}::>{{#var: entry }}]][[{{#var: property }}::<{{#var: span }}]]|?{{#var: property }}|sort=sortform|format=table|limit=0|searchlabel=show&nbsp;list|default=&nbsp;}}|{{#ask:[[Category:{{#var: category }}]][[{{#var: property }}::{{#var: entry }}]]|?{{#var: property }}|sort=sortform|format=table|limit=0|searchlabel=show&nbsp;list|default=&nbsp;}} }} }} }}{{#vardefine: i | {{ #expr: {{ #var: i }} + 1 }} }} }}
|}{{#ifexpr: {{#var: pmax }} > 100 |<div style="width:{{var|image_width}}px; font-size:x-small; text-align:justify;">Please note that the percentage is always calculated as ratio of "pages containing the respective value" to "all pages using this property". Since it is possible to define multiple values per page, the sum of the percentages may be more than 100&nbsp;%. {{#var: n_values }} values have been defined on {{#var: all }} pages.</div>}}
{{!}}}{{#ifexpr: {{#var: pmax }} > 100 |<div style="width:{{var|image_width}}px; font-size:x-small; text-align:justify;">Please note that the percentage is always calculated as ratio of "pages containing the respective value" to "all pages using this property". Since it is possible to define multiple values per page, the sum of the percentages may be more than 100&nbsp;%. {{#var: n_values }} values have been defined on {{#var: all }} pages.</div>}}
{{#ifeq: {{{2|}}}|||Arithmetic mean: {{#ask:[[Category:{{#var: category }}]][[{{#var: property }}::+]]|?{{#var: property }}|format=average|limit=1000}}, Median: {{#ask:[[Category:{{#var: category }}]][[{{#var: property }}::+]]|?{{#var: property }}|format=median|limit=1000}} }}[[Category:Statistics]]</includeonly>
{{#ifeq: {{{2|}}}|||Arithmetic mean: {{#ask:[[Category:{{#var: category }}]][[{{#var: property }}::+]]|?{{#var: property }}|format=average|limit=1000}}, Median: {{#ask:[[Category:{{#var: category }}]][[{{#var: property }}::+]]|?{{#var: property }}|format=median|limit=1000}} }}[[Category:Statistics]]}}</includeonly>

Latest revision as of 03:56, 30 November 2013

This template serves to display simple statistics on property pages with pre-defined values.

Usage

  • This template can only be used on property pages
  • The first parameter defines the category of the pages to be displayed in the statistics, i.e. {{property statistics|Category}}
  • Additional parameters can be used to display numbers:
    • (2) start: mandatory for numbers
    • (3) stop: if the stop value is omitted, 10 times the step value is used per default
    • (4) step: if the step value is omitted, 1 is used per default
    • (5) "range" (optional)

Examples

  • The code {{property statistics|Inscription}} on the page Property:language will display the occurrence of pages in the Category:Inscription per each pre-defined language (i.e. Raetic, Etruscan, Venetic, Lepontic, Cisalpine Gaulish, Celtic, Latin, English, French, German, Italian, unknown, none, Camunic, Spanish, Slovenian).
  • The code {{property statistics|Inscription|0|360|15}} on the page Property:orientation will display the occurrence of pages in the Category:Inscription of every 15 degrees from 0 to 360 (i.e. 0, 15, 30, 45, ..., 360), while {{property statistics|Inscription|3}} will do the same for every integer from 3 to 13.
  • The code {{property statistics|Object|-650|50|100|range}} on the page Property:sortdate will display the occurrence of pages in the Category:Object grouped in 100 years from 650 BC to 50 AD (i.e. -650 to -550, -550 to -450, ..., -50 to 50).