Difference between revisions of "Template:Data bars"
Jump to navigation
Jump to search
imported>Jonathan Lane Studeman (class plainlinks) |
imported>Jonathan Lane Studeman |
||
| Line 484: | Line 484: | ||
| scale = {{{scale|1}}} | | scale = {{{scale|1}}} | ||
| columns = {{{columns|1}}} | | columns = {{{columns|1}}} | ||
| − | |{{{1|}}}|{{{2|}}}|{{{3|}}}|{{{4|}}}|{{{5|}}}|{{{6|}}}|{{{7|}}}|{{{8|}}}|{{{9|}}}|{{{10|}}} | + | | {{{1|}}}| {{{2|}}}| {{{3|}}}| {{{4|}}}| {{{5|}}}| {{{6|}}}| {{{7|}}}| {{{8|}}}| {{{9|}}}| {{{10|}}} |
| − | |{{{11|}}}|{{{12|}}}|{{{13|}}}|{{{14|}}}|{{{15|}}}|{{{16|}}}|{{{17|}}}|{{{18|}}}|{{{19|}}}|{{{20|}}} | + | | {{{11|}}}| {{{12|}}}| {{{13|}}}| {{{14|}}}| {{{15|}}}| {{{16|}}}| {{{17|}}}| {{{18|}}}| {{{19|}}}| {{{20|}}} |
| − | |{{{21|}}}|{{{22|}}}|{{{23|}}}|{{{24|}}}|{{{25|}}}|{{{26|}}}|{{{27|}}}|{{{28|}}}|{{{29|}}}|{{{30|}}} | + | | {{{21|}}}| {{{22|}}}| {{{23|}}}| {{{24|}}}| {{{25|}}}| {{{26|}}}| {{{27|}}}| {{{28|}}}| {{{29|}}}| {{{30|}}} |
| − | |{{{31|}}}|{{{32|}}}|{{{33|}}}|{{{34|}}}|{{{35|}}}|{{{36|}}}|{{{37|}}}|{{{38|}}}|{{{39|}}}|{{{40|}}} | + | | {{{31|}}}| {{{32|}}}| {{{33|}}}| {{{34|}}}| {{{35|}}}| {{{36|}}}| {{{37|}}}| {{{38|}}}| {{{39|}}}| {{{40|}}} |
| − | |{{{41|}}}|{{{42|}}}|{{{43|}}}|{{{44|}}}|{{{45|}}}|{{{46|}}}|{{{47|}}}|{{{48|}}}|{{{49|}}}|{{{50|}}} | + | | {{{41|}}}| {{{42|}}}| {{{43|}}}| {{{44|}}}| {{{45|}}}| {{{46|}}}| {{{47|}}}| {{{48|}}}| {{{49|}}}| {{{50|}}} |
| − | |{{{51|}}}|{{{52|}}}|{{{53|}}}|{{{54|}}}|{{{55|}}}|{{{56|}}}|{{{57|}}}|{{{58|}}}|{{{59|}}}|{{{60|}}} | + | | {{{51|}}}| {{{52|}}}| {{{53|}}}| {{{54|}}}| {{{55|}}}| {{{56|}}}| {{{57|}}}| {{{58|}}}| {{{59|}}}| {{{60|}}} |
| − | |{{{61|}}}|{{{62|}}}|{{{63|}}}|{{{64|}}}|{{{65|}}}|{{{66|}}}|{{{67|}}}|{{{68|}}}|{{{69|}}}|{{{70|}}} | + | | {{{61|}}}| {{{62|}}}| {{{63|}}}| {{{64|}}}| {{{65|}}}| {{{66|}}}| {{{67|}}}| {{{68|}}}| {{{69|}}}| {{{70|}}} |
| − | |{{{71|}}}|{{{72|}}}|{{{73|}}}|{{{74|}}}|{{{75|}}}|{{{76|}}}|{{{77|}}}|{{{78|}}}|{{{79|}}}|{{{80|}}} | + | | {{{71|}}}| {{{72|}}}| {{{73|}}}| {{{74|}}}| {{{75|}}}| {{{76|}}}| {{{77|}}}| {{{78|}}}| {{{79|}}}| {{{80|}}} |
| − | |{{{81|}}}|{{{82|}}}|{{{83|}}}|{{{84|}}}|{{{85|}}}|{{{86|}}}|{{{87|}}}|{{{88|}}}|{{{89|}}}|{{{90|}}} | + | | {{{81|}}}| {{{82|}}}| {{{83|}}}| {{{84|}}}| {{{85|}}}| {{{86|}}}| {{{87|}}}| {{{88|}}}| {{{89|}}}| {{{90|}}} |
| − | |{{{91|}}}|{{{ | + | | {{{91|}}}| {{{92|}}}| {{{93|}}}| {{{94|}}}| {{{95|}}}| {{{96|}}}| {{{97|}}}| {{{98|}}}| {{{99|}}}|{{{100|}}} |
|{{{101|}}}|{{{102|}}}|{{{103|}}}|{{{104|}}}|{{{105|}}}|{{{106|}}}|{{{107|}}}|{{{108|}}}|{{{109|}}}|{{{110|}}} | |{{{101|}}}|{{{102|}}}|{{{103|}}}|{{{104|}}}|{{{105|}}}|{{{106|}}}|{{{107|}}}|{{{108|}}}|{{{109|}}}|{{{110|}}} | ||
|{{{111|}}}|{{{112|}}}|{{{113|}}}|{{{114|}}}|{{{115|}}}|{{{116|}}}|{{{117|}}}|{{{118|}}}|{{{119|}}}|{{{120|}}} | |{{{111|}}}|{{{112|}}}|{{{113|}}}|{{{114|}}}|{{{115|}}}|{{{116|}}}|{{{117|}}}|{{{118|}}}|{{{119|}}}|{{{120|}}} | ||
Revision as of 07:48, 15 January 2015
Contents
Usage
This is a template for displaying a bar chart.
|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
| Given multiple data rows that look like this: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ↔ Max. data columns: 16 ↔ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
{{Data bars
| 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 ↕ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Title, Scale, Source and Alignment
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.
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Also, to center or to float a chart left or right, specify center, right or left in parameter align (aka float). For example:
| Berries | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Total: 272 |
{{Data bars
| align = right
| columns = 6 | Jan| Feb| Mar| Apr| May| Jun
| blue|Berries| 65| 38| 72| 47| 20| 30
}}
|
Orientation, Borders, Details and Averages
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. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| And here's exactly the same data in style=13, showing averages on the right instead of totals: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Method
This template employs five "sub-templates." A table is created using the columns and rows of data.
- {{Data bars/bar}} draws each vertical or horizontal rectangle optionally colored and labeled with a name and/or a value.
- {{Data bars/column}} 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.
- {{Data bars/averages}} calculates the averages of all the rows of data.
- {{Data bars/averages/display}} assigns the averages to named parameters for display as a single complex bar.
- {{Data bars/averages/column}} draws a vertical labeled bar of averages serving as a color key.
| The above documentation is transcluded from Template:Data bars/doc. (edit | history) Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages. Please add categories to the /doc subpage. Subpages of this template. |