Template:property statistics: Difference between revisions
From Thesaurus Inscriptionum Raeticarum
Jump to navigationJump to search
Martin Braun (talk | contribs) No edit summary |
Martin Braun (talk | contribs) No edit summary |
||
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 page]]|[[{{#ask:[[Category:{{#var: category }}]][[{{#var: property }}::{{#var: entry }}]]|mainlabel=-|?#-|format=list}}|show page]]}}|{{#ifeq: {{{5|}}}|range|{{#ask:[[Category:{{#var: category }}]][[{{#var: property }}::>{{#var: entry }}]][[{{#var: property }}::<{{#var: span }}]] | {{!}} {{#ifeq: {{#var: n}}|1|{{#ifeq: {{{5|}}}|range|[[{{#ask:[[Category:{{#var: category }}]][[{{#var: property }}::>{{#var: entry }}]][[{{#var: property }}::<{{#var: span }}]]|mainlabel=-|?#-|format=list}}|show page]]|[[{{#ask:[[Category:{{#var: category }}]][[{{#var: property }}::{{#var: entry }}]]|mainlabel=-|?#-|format=list}}|show 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 list|default= }}|{{#ask:[[Category:{{#var: category }}]][[{{#var: property }}::{{#var: entry }}]]|?{{#var: property }}|sort=sortform|format=table|limit=0|searchlabel=show list|default= }} }} }} }}{{#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 %. {{#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 %. {{#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
- with restricted allowed values or
- with the Type:Number
- 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).