Sjabloon:Chg/doc

Uit informatiestandaarden
Naar navigatie springen Naar zoeken springen

Use

This template calculates the percent change between two real number values and displays the result in a selectable format.

The syntax for this template is: {{chg|var1|var2|dec=2|color=yes|sort=yes}} where:

  • var1 = real number — representing the base value
  • var2 = real number — representing the object value
  • dec= integer number — decimal places to display in percent change (default=2)
  • color=yes — display percent change in the following colors: (default)
    • gain in green
    • default color
    • loss in red
  • color=no — display percent change in default color
  • sort=yes — add a hidden sort key prefix (default)
  • sort=no — don’t add a hidden sort key prefix

The following sortable table illustrates the use of this template.

Region Wikitext   default   dec=0   color=no   sort=no
Big Meadow {{chg|1830000|1900679.75}} !B9710177208335 +{{#invoke:Math|precision_format| 3.862281420765 | 2}}% !B9710177208335 +{{#invoke:Math|precision_format| 3.862281420765 | 0}}% !B9710177208335 +{{#invoke:Math|precision_format| 3.862281420765 | 2}}% +{{#invoke:Math|precision_format| 3.862281420765 | 2}}%
Mount Acme {{chg|2450000|2205678.37}} !J0322334186043 {{#invoke:Math|precision_format| -9.9723114285714 | 2}}% !J0322334186043 {{#invoke:Math|precision_format| -9.9723114285714 | 0}}% !J0322334186043 {{#invoke:Math|precision_format| -9.9723114285714 | 2}}% {{#invoke:Math|precision_format| -9.9723114285714 | 2}}%
Homeport {{chg|5120000|5589462.60}} !B9724557148728 +{{#invoke:Math|precision_format| 9.16919140625 | 2}}% !B9724557148728 +{{#invoke:Math|precision_format| 9.16919140625 | 0}}% !B9724557148728 +{{#invoke:Math|precision_format| 9.16919140625 | 2}}% +{{#invoke:Math|precision_format| 9.16919140625 | 2}}%
Longwood {{chg|930000|930027.92}} !B9804799903783 +{{#invoke:Math|precision_format| 0.0030021505376343 | 2}}% !B9804799903783 +{{#invoke:Math|precision_format| 0.0030021505376343 | 0}}% !B9804799903783 +{{#invoke:Math|precision_format| 0.0030021505376343 | 2}}% +{{#invoke:Math|precision_format| 0.0030021505376343 | 2}}%
Meadowbrook {{chg|2450000|2450000.00}} !F ±{{#invoke:Math|precision_format| 0 | 2}}% !F ±{{#invoke:Math|precision_format| 0 | 0}}% !F ±{{#invoke:Math|precision_format| 0 | 2}}% ±{{#invoke:Math|precision_format| 0 | 2}}%
Johnstown {{chg|3400000|3902340.05}} !B9696760621278 +{{#invoke:Math|precision_format| 14.774707352941 | 2}}% !B9696760621278 +{{#invoke:Math|precision_format| 14.774707352941 | 0}}% !B9696760621278 +{{#invoke:Math|precision_format| 14.774707352941 | 2}}% +{{#invoke:Math|precision_format| 14.774707352941 | 2}}%
Lakewood {{chg|2250000|2236005.56}} !J0317613361005 {{#invoke:Math|precision_format| -0.62197511111111 | 2}}% !J0317613361005 {{#invoke:Math|precision_format| -0.62197511111111 | 0}}% !J0317613361005 {{#invoke:Math|precision_format| -0.62197511111111 | 2}}% {{#invoke:Math|precision_format| -0.62197511111111 | 2}}%
Fox Hollow {{chg|1180000|1190345.32}} !B9701979590790 +{{#invoke:Math|precision_format| 0.8767220338983 | 2}}% !B9701979590790 +{{#invoke:Math|precision_format| 0.8767220338983 | 0}}% !B9701979590790 +{{#invoke:Math|precision_format| 0.8767220338983 | 2}}% +{{#invoke:Math|precision_format| 0.8767220338983 | 2}}%
Riverton {{chg|10550000|11236005.55}} !B9681942190259 +{{#invoke:Math|precision_format| 6.5024222748815 | 2}}% !B9681942190259 +{{#invoke:Math|precision_format| 6.5024222748815 | 0}}% !B9681942190259 +{{#invoke:Math|precision_format| 6.5024222748815 | 2}}% +{{#invoke:Math|precision_format| 6.5024222748815 | 2}}%
Timber Creek {{chg|1360000|1310948.30}} !J0312164112601 {{#invoke:Math|precision_format| -3.6067426470588 | 2}}% !J0312164112601 {{#invoke:Math|precision_format| -3.6067426470588 | 0}}% !J0312164112601 {{#invoke:Math|precision_format| -3.6067426470588 | 2}}% {{#invoke:Math|precision_format| -3.6067426470588 | 2}}%
Terminated {{chg|1500|0.00}} !I {{#invoke:Math|precision_format| -100 | 2}}% !I {{#invoke:Math|precision_format| -100 | 0}}% !I {{#invoke:Math|precision_format| -100 | 2}}% {{#invoke:Math|precision_format| -100 | 2}}%
Upstart {{chg|0|26250.50}} NA NA NA NA

See also

  • This template invokes {{Nk}}
  • The {{change}} and {{change2}} templates are the base for this one, but color the text, not the background