Template talk:Hist5

Add topic
From Meta, a Wikimedia project coordination wiki

This is an experimental template that produces sideways bars consisting of multiple occurrences of a specified symbol or text (the first parameter). Unfortunately it works only for a fixed number of bars (five): Template:X4, etc. provide repetition of a parameter, but their results (template content) cannot be used as parameter, so even a variable size rectangle (with the sides given by two parameters) is not possible.

Therefore, for general use a series of templates like this would be needed.

See also Template:Hist5 n and Template:Hist10.

{{histogram|x|3|1|5|4|1}} gives:

xxx
x
xxxxx
xxxx
x

{{histogram|oooooo|3|1|5|4|1}} gives:

oooooooooooooooooo
oooooo
oooooooooooooooooooooooooooooo
oooooooooooooooooooooooo
oooooo

{{histogram|+|3|1|5|4|1}} gives:

+++
+
+++++
++++
+

{{histogram|-Wikipedia-|3|1|5|4|1}} gives:

-Wikipedia--Wikipedia--Wikipedia-
-Wikipedia-
-Wikipedia--Wikipedia--Wikipedia--Wikipedia--Wikipedia-
-Wikipedia--Wikipedia--Wikipedia--Wikipedia-
-Wikipedia-

For using "=" as repeated symbol, put nowiki tags around it; result:

===
=
=====
====
=

{{histogram|█|3|1|5|4|1}} gives:

███

█████
████

Too few parameters: {{histogram|x|3|1|5|4}} gives:

xxx
x
xxxxx
xxxx
{{{{{6}}}x|x}}

Histogram demo[edit]

Below the templates xn are called directly.

Rank Province Population % Density
Netherlands 16 254 800 100.0% 391.4
1 South Holland 3 453 000 21.2% 1 207.3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2 North Holland 2 583 900 15.9% 971.4 xxxxxxxxxxxxxxxxxxxxxxxxxx
3 North Brabant 2 406 900 14.8% 487.4 xxxxxxxxxxxxxxxxxxxxxxxx
4 Gelderland 1 967 600 12.1% 393.9 xxxxxxxxxxxxxxxxxxx
5 Utrecht 1 159 200 7.1% 854.9 xxxxxxxxxxxx
6 Limburg 1 143 000 7.0% 527.5 xxxxxxxxxxx
7 Overijssel 1 105 800 6.8% 331.4 xxxxxxxxxxx
8 Friesland 642 500 4.0% 191.2 xxxxxx
9 Groningen 575 900 3.5% 245.7 xxxxxx
10 Drenthe 482 300 3.0% 181.9 xxxxx
11 Zeeland 378 300 2.3% 211.1 xxxx
12 Flevoland 356 400 2.2% 249.9 xxxx

For more accuracy "|" could be used, but in a table that requires nowiki tags.

Rank Province Population % Density
Netherlands 16 254 800 100.0% 391.4
1 South Holland 3 453 000 21.2% 1 207.3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
2 North Holland 2 583 900 15.9% 971.4 xxxxxxxxxxxxxxxxxxxxxxxxxx
3 North Brabant 2 406 900 14.8% 487.4 xxxxxxxxxxxxxxxxxxxxxxxx
4 Gelderland 1 967 600 12.1% 393.9 xxxxxxxxxxxxxxxxxxx
5 Utrecht 1 159 200 7.1% 854.9 xxxxxxxxxxxx
6 Limburg 1 143 000 7.0% 527.5 xxxxxxxxxxx
7 Overijssel 1 105 800 6.8% 331.4 xxxxxxxxxxx
8 Friesland 642 500 4.0% 191.2 xxxxxx
9 Groningen 575 900 3.5% 245.7 .........................................................
10 Drenthe 482 300 3.0% 181.9 ................................................
11 Zeeland 378 300 2.3% 211.1 .....................................
12 Flevoland 356 400 2.2% 249.9 ...................................