[visa] [redigera] [rensa sidcachen]
Dokumentation
Den här mallen tillåter många staplar i sid- eller höjdled. Den är i dagsläget inte användbar för mobila enheter (det mobila gränssnittet). Problemet torde även finnas i enwp-varianten av mallen. Liknande diagram kan göras med hjälp av {{Graph:Chart}}
.
This is a template for displaying a bar chart.
Simple example in the default style:{{Stapeldiagram2
| columns = 6 | Jan| Feb| Mar| Apr| May| Jun
| blue|Berries| 65| 38| 72| 47| 20| 30
}}
|
|
|
Same thing, but horizontal (style=2):{{Stapeldiagram2
| style = 2
| columns = 6 | Jan| Feb| Mar| Apr| May| Jun
| blue|Berries| 65| 38| 72| 47| 20| 30
}}
|
|
|
Given multiple data rows that look like this:
|
↔ Max. data columns: 16 ↔
|
{{Stapeldiagram2
| columns = 12 |Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec
| green| Apples| 60| 70| 90| 30| 50| 30|100|130|120| 90| 50|110
|yellow| Bananas| 90| 80|110| 60| 70| 80| 70| 70| 40| 50| 50| 60
|orange| Oranges| 50| 40| 60|110| 90| 60| 30| 60| 70| 60| 80| 40
}}
|
↕ Max. data rows: 8 ↕
|
- ...the template displays a complex, color-keyed chart that looks like this:
|
|
|
|
|
|
|
|
|
|
|
|
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
|
Total: 2510
|
|
|
Optional named parameters include title, scale and source.
- A title appears bolded and centered above the chart.
- A scale is needed for handling very small or large numbers.
- A source tells the viewer where the data came from.
title = Small numbers, large scalescale = 10source = Data invented for this example.
{{Stapeldiagram2
| title = Small numbers, large scale
| scale = 10
| source = Data invented for this example.
| columns = 6 |Jan|Feb|Mar|Apr|May|Jun
| red|Cherries| 6| 7| 9| 3| 5| 3
| blue| Berries| 9| 8| 11| 6| 7| 8
|purple| Grapes| 5| 4| 6| 11| 9| 6
}}
|
Small numbers, large scale
|
|
Total: 123
|
Source: Data invented for this example.
|
|
|
title = Large numbers, small scalescale = 0.1 style = 2source = Data invented for this example.
{{Stapeldiagram2
| title = Large numbers, small scale
| scale = 0.1 | style = 2
| source = Data invented for this example.
| columns = 6 | Jul| Aug| Sep| Oct| Nov| Dec
| green| Apples| 600| 700| 900| 300| 500| 300
|yellow| Bananas| 900| 800|1100| 600| 700| 800
|orange| Oranges| 500| 400| 600|1100| 900| 600
}}
|
Large numbers, small scale
|
|
Total: 12300
|
Source: Data invented for this example.
|
|
|
Also, to center or to float a chart left or right, specify center, right or left in parameter align (aka float). For example:
{{Stapeldiagram2
| align = right
| columns = 6 | Jan| Feb| Mar| Apr| May| Jun
| blue|Berries| 65| 38| 72| 47| 20| 30
}}
|
There are sixteen styles to choose from.
- Odd numbered styles are vertical.
- Even numbered styles are horizontal.
- Styles 3 and 4 have borders and shading.
- Styles 5 thru 8 are the same as 1 thru 4, but show additional detail.
- Styles 9 thru 16 are the same as 1 thru 8, but averages are displayed with the color key, instead of totals.
For example, here's one using style=8:
Horizontal, with borders, shading and visible detail.
|
{{Stapeldiagram2
| style = 8
| scale = 0.1
| title = Fruit Amounts (lbs)
| source = Data invented for this example.
| columns = 6 |2009|2010|2011|2012|2013|2014
| green| Apples| | 700| 900| 300| 500| 300
|yellow| Bananas| 900| |1100| 600| 700| 800
|orange| Oranges| 500| 400| |1100| 900| 600
| red|Cherries| 700| 300| 600| | 900| 600
| blue| Berries| 300| 500| 600| 900| 700|
}}
|
|
Fruit Amounts (lbs)
|
2009
|
|
2010
|
|
2011
|
|
2012
|
|
2013
|
|
2014
|
|
|
|
Total: 16400
|
Source: Data invented for this example.
|
|
And here's exactly the same data in style=13, showing averages on the right instead of totals:
|
Fruit Amounts (lbs)
|
|
|
|
|
|
|
2009
|
2010
|
2011
|
2012
|
2013
|
2014
|
|
|
|
Source: Data invented for this example.
|
|
This template employs five "sub-templates." A table is created using the columns and rows of data.
- {{Stapeldiagram2/stapel}} draws each vertical or horizontal rectangle optionally colored and labeled with a name and/or a value.
- {{Stapeldiagram2/kolumn}} handles one column of data.
If style is > 8, the data is passed along to other sub-templates to display averages instead of totals with the color key.
- {{Stapeldiagram2/medelvärden}} calculates the averages of all the rows of data.
- {{Stapeldiagram2/medelvärden/visning}} assigns the averages to named parameters for display as a single complex bar.
- {{Stapeldiagram2/medelvärden/kolumn}} draws a vertical labeled bar of averages serving as a color key.
Ovanstående
dokumentation transkluderas från sidan ”
Mall:Stapeldiagram2/dok”. Kategorier ska placeras på den dokumentationssidan.