Template:Bartable/doc

This template adds an inline bar graph to tables with numeric (including negative) values that a reader may wish to compare.

Use this template inside a table. The template generates either two table cells (for cases in which all values are positive) or three (to accommodate negative bars going off to the left). Thus, your table headers should have colspan="2" or colspan="3" (or similar combinations), respectively, to correctly span the columns.

The template generates two cells if the scale parameter is positive and three if it is negative.

Usage

 * value (mandatory) : any real number or math expression that evaluates to a number. Commas can be used to group digits. See Help:Calculation for the syntax for math expressions.
 * unit (default = empty string) : the unit, e.g. "m" for metres. Prepend a space if you want a space between the value and the unit. If unit starts with "/", the value is converted between units (using the convert template) as follows:
 * "/unit1/unit2/round" converts the value from unit1 to unit2 and rounds it to round decimal places (using ). Unfortunately unit1, unit2 or round cannot contain a "/" or a "=" — if anyone knows how to allow it (or translate other characters to it), please help.


 * scale (default = 1) : a factor multiplied by value to give the width of the bar in pixels. Use the same scale in every row, as otherwise the bar chart won’t be to scale!
 * scale can be negative, in which case an additional column (for showing negative values) is created. See example below.


 * height (default = "2ex") : the height of the bar as a CSS measurement e.g. "1em" or "16px".
 * style (default = empty string) : a CSS style string to apply to the bar, e.g. "background:red;".