Template:Bartable/doc
< Template:Bartable
Jump to navigation
Jump to search
Revision as of 12:33, 2 June 2011 by imported>Cmglee (Create documentation)
| This is a documentation subpage for Template:Bartable. It contains usage information, categories and other content that is not part of the original template page. |
This template adds an inline bar graph to tables with numeric (including negative) values that a reader may wish to compare. It takes up 3 columns of a table, so headers should have colspan="3" (or similar combination) to correctly span the columns.
Notes:
- A "negative" bars column is created even if there are no negative values (and vice versa); if anyone knows how to collapse the column (zero width/padding/margins), please help.
- A negative value of scale will not change the side of the bar.
Usage
{{bartable|value|unit|scale|height|style}}
- value (mandatory) is any real number or math expression that evaluates to a number.
- unit (default: empty string) is a suffix to be appended to value. If unit starts with "/", the convert template is used as follows: "/unit1/unit2/round" is translated to "{{convert|value|unit1|unit2|round|abbr=on}}. (Note: unit1 and unit2 cannot contain "/" or "=". If anyone knows how to allow it (or translate other characters to it), please help.)
- scale (default: "1") is a positive factor multiplied by value to give the width of the bar in pixels.
- height (default: "2ex") is the height of the bar as a CSS measurement e.g. "1em" or "16px".
- style (default: empty string) is the content of a CSS style string to apply to the bar e.g. "background:red;".
Examples
Click Edit to view source.
| Example | Rendering | ||
|---|---|---|---|
| No parameters | — | ||
| Only value | 272 | ||
| Negative value | -72 | ||
| Math expression | exp(1)*1e2 | ||
| Value and ordinary unit | 272km/h | ||
| Value and convert unit | 272 km (147 nmi) | ||
| Value and scale | 272 | ||
| Value and height | 272 | ||
| Value and style | 272 | ||
| The full monty | −72 km (−39 nmi) | ||
Real-world example:
| Substance | Temperature | Relative size | |
|---|---|---|---|
| Mercury | −38.72 °C (−37.70 °F) | ||
| Bromine | −7.10 °C (19.22 °F) | ||
| Water | 0 °C (32 °F) | ||
| Phosphorus | 44.10 °C (111.38 °F) | ||
| Iodine | 113.50 °C (236.30 °F) | ||
| Sulphur | 115.36 °C (239.65 °F) | ||