使用方法

該模板可計算兩個實數之間的百分比變化,並將結果直觀的用顏色表示。

該模板的完整語法如下:

{{change|1st No.|2nd No.|dec=rounding|pre=prefix|suf=suffix|sort=on/off|italics=on/off|bold=on/off|invert=on/off|disp=row/out|rowspan=rowspan|align=alignment|bgcolour=background colour}}

參數 解釋
1 表示基準值。
2 表示對象值。
dec 參數可表示表示小數點位數。例如dec=3表示四捨五入至小數點後三位。
pre 在兩數值上增加前綴。
suf 在兩數值上增加後綴。
sort 該參數將增加或移除{{nts}},即對表格進行排序。 默認為開啟(注意:僅當需要時)
italics 參數可填入on or offitalics=on可使其字體斜體,默認為italics=off
bold 參數可填入on or offbolds=on可使其字體斜體,默認為bold=off
invert 參數可填入onoffinvert=on為開啟,可反轉基準值與對象值。默認為invert=off
align 調整文本、數值在單元格中的對齊方式,可填入align=centeralign=left默認為右對齊(align=right)。
rowspan 向下合併的單元格數,默認值為rowspan=1
bgcolour 調整單元格的背景顏色,默認為bgcolour=#F9F9F9(亮灰色)。
disp 作用為控制輸出方式,可填入disp=out表示只輸出百分比變化一行的單元格。(對齊方式align、合併單元格rowspan和背景顏色bgcolour不在disp=out作用範圍內。)默認值disp=row作用於表格中的三行單元格。

下表就是該模板的一個例子:

維基語法 表格
{|class="wikitable sortable"
!地区
!数值1
!数值2
!变化
|-
|Big Meadow
|{{change|1830000|1900679.75}}
|-
|Little Meadow
|{{change|400000|500000}}
|-
|Mount Acme
|{{change|2450000|2205678.37}}
|-
|Acmevale North
|{{change|1250000|1000000|rowspan=2}}
|-
|Acmevale South
|-
|Homeport
|{{change|5120000|5589462.60|dec=0}}
|-
|Longwood
|{{change|930000|930027.92|dec=3}}
|-
|Meadowbrook
|{{change|2450000|2450000.00|pre=$}}
|-
|Johnstown
|{{change|3400000|3902340.05|suf= kg}}
|-
|Lakewood
|{{change|2250000|2236005.56|align=center}}
|-
|bgcolor=lightblue|Fox Hollow
|{{change|1180000|1190345.32|bgcolour=lightblue}}
|-
|Riverton
|{{change|10550000|11236005.55|bold=on}}
|-
|Timber Creek
|{{change|1360000|1310948.30|italics=on}}
|-
|Terminated
|{{change|1500|0.00|bold=on|italics=on}}
|-
|Upstart
|{{change|0|26250.50|align=left}}
|-
|}
若為默認值:
地區 數值1 數值2 變化
Big Meadow 1,830,000 1,900,679.75 +3.86%
Little Meadow 400,000 500,000 +25.00%
Mount Acme 2,450,000 2,205,678.37 −9.97%
Acmevale North 1,250,000 1,000,000 −20.00%
Acmevale South
Homeport 5,120,000 5,589,462.6 +9%
Longwood 930,000 930,027.92 +0.003%
Meadowbrook $2,450,000 $2,450,000 0.00%
Johnstown 3,400,000 kg 3,902,340.05 kg +14.77%
Lakewood 2,250,000 2,236,005.56 −0.62%
Fox Hollow 1,180,000 1,190,345.32 +0.88%
Riverton 10,550,000 11,236,005.55 +6.50%
Timber Creek 1,360,000 1,310,948.3 −3.61%
Terminated 1,500 0 −100.00%
Upstart 0 26,250.5 NA
With |disp=out
地區 變化
Big Meadow +3.86%
Little Meadow +25.00%
Mount Acme −9.97%
Acmevale North −20.00%
Acmevale South
Homeport +9%
Longwood +0.003%
Meadowbrook 0.00%
Johnstown +14.77%
Lakewood −0.62%
Fox Hollow +0.88%
Riverton +6.50%
Timber Creek −3.61%
Terminated −100.00%
Upstart NA
With |invert=on
地區 數值1 數值2 變化
Big Meadow 1,830,000 1,900,679.75 −3.72%
Little Meadow 400,000 500,000 −20.00%
Mount Acme 2,450,000 2,205,678.37 +11.08%
Acmevale North 1,250,000 1,000,000 +25.00%
Acmevale South
Homeport 5,120,000 5,589,462.6 −8%
Longwood 930,000 930,027.92 −0.003%
Meadowbrook $2,450,000 $2,450,000 0.00%
Johnstown 3,400,000 kg 3,902,340.05 kg −12.87%
Lakewood 2,250,000 2,236,005.56 +0.63%
Fox Hollow 1,180,000 1,190,345.32 −0.87%
Riverton 10,550,000 11,236,005.55 −6.11%
Timber Creek 1,360,000 1,310,948.3 +3.74%
Terminated 1,500 0 NA
Upstart 0 26,250.5 −100.00%
With |invert=on and |disp=out
地區 變化
Big Meadow −3.72%
Little Meadow −20.00%
Mount Acme +11.08%
Acmevale North +25.00%
Acmevale South
Homeport −8%
Longwood −0.003%
Meadowbrook 0.00%
Johnstown −12.87%
Lakewood +0.63%
Fox Hollow −0.87%
Riverton −6.11%
Timber Creek +3.74%
Terminated NA
Upstart −100.00%

此模板調用模塊:MathTemplate:ntsh,併兼容Template:ntsTemplate:ntsh