Template:Changes/doc

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

This template takes up to 20 numbers and calculates the percent change between each pair and formats them for inclusion in a table in either ascending or descending order.

This template has the following syntax:

{{Changes|number01|...|number20|order=|nd=|pd=|ic=|dc=}}

where:

  • number01|...|number20 are up to 20 numbers. If a number is not known, use NA or &#​32;
  • order= is an optional change calculation order:
    • order=a calculate percent change in ascending order. (default)
    • order=d calculate percent change in descending order.
  • nd= is an optional number of decimal places in the formatted numbers. (default=0)
  • pd= is an optional number of decimal places in the formatted percent changes. (default=2)
  • ic= is an optional color for a percent increase. (default=green)
  • dc= is an optional color for a percent decrease. (default=red)

Example

[edit source]

The following Wiki markup:

{|class="wikitable sortable"
![[U.S. state|State]]
![[1980 United States census|1980 census]]
!% Pop change
![[1990 United States census|1990 census]]
!% Pop change
![[2000 United States census|2000 census]]
!% Pop change
![[2010 United States census|2010 census]]
!% Pop change
![[2020 United States census|2020 census]]
|-
|[[Wyoming]]
{{changes|469557|453588|493782|563626|576851}}
|}

creates the following table:

State 1980 census % Pop change 1990 census % Pop change 2000 census % Pop change 2010 census % Pop change 2020 census
Wyoming 469,557 −3.40% 453,588 +8.86% 493,782 +14.14% 563,626 +2.35% 576,851

You can put this table in descending order with {{changes|order=d|576851|563626|493782|453588|469557}}:

State 2020 census % Pop change 2010 census % Pop change 2000 census % Pop change 1990 census % Pop change 1980 census
Wyoming 576,851 +2.35% 563,626 +14.14% 493,782 +8.86% 453,588 −3.40% 469,557

See also

[edit source]