Template:Data bars/bar/doc

This template draws a "bar" with a 1-pixel gray border for use in a bar chart. By default the bar is colored light gray and has an internal width and height of 20 pixels.

Color
A parameter called color specifies the color of the bar.

By combining colors with labels (see below), you can easily produce a color key. For example,

Height or Width
A parameter called height specifies the internal height of the bar in a vertical bar chart.

A parameter called width specifies the width of the bar in a horizontal bar chart.

Height and width cannot be used together. However, if bars of a different width are desired in a vertical bar chart, or bars of a different height are desired in a horizontal bar chart, a parameter called size can be used.

Stacking
Bars can be "stacked," in vertical or horizontal charts, simply by listing them consecutively.

Labels
Labels can be applied to bars using the parameters label and/or value and/or name.

Label
A label is applied below the bar.

Value
A value is a label with a smaller font-size and that might be used to display a number that is represented by the bar.

This so-called value of the bar is displayed above the bar in a vertical bar chart, and to the right of the bar in a horizontal bar chart.

The value does not have to be a number.

However, for the sake of simplicity in a vertical bar chart (only), the height can be omitted if a numerical value is provided.

Name
A name is the final type of label that is available. Just like a value, it has a smaller font-size and might be used to display a number represented by the bar.

The only difference is its placement. The name, if any, is displayed to the right of the bar in a vertical bar chart, and above the bar in a horizontal bar chart.

Titles
By default, the color of a bar is displayed as text when the cursor is pointed at the bar. This is helpful to persons with color blindness.

However, you can override the default and provide even more helpful information by specifying a "title" for the bar.

This may be especially handy in a color key, to display totals, for example.

Alternatively, a title can be appended parenthetically to a name by setting a parameter called detailed.

If you are creating a template, such as Data bars, this adds some flexibility by allowing you to use the title parameter to display more detailed information about a bar right on the page while leaving the default as it was.