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.
A parameter called color specifies the color of the bar.
{{Datenbalken/bar|color=powderblue}}
|
|
{{Datenbalken/bar|color=#B0E0E6}}
|
|
By combining colors with labels (see below), you can easily produce a color key. For example,
{{Datenbalken/bar|color=red |name=California}}
{{Datenbalken/bar|color=blue |name=Florida }}
{{Datenbalken/bar|color=yellow|name=Oregon }}
{{Datenbalken/bar|color=green |name=Missouri }}
|
|
A parameter called height specifies the internal height of the bar in a vertical bar chart.
{{Datenbalken/bar
| color = green
| height = 60
}}
|
|
A parameter called width specifies the width of the bar in a horizontal bar chart.
{{Datenbalken/bar
| color = yellow
| width = 60
}}
|
|
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.
{{Datenbalken/bar
| color = orange
| height = 80
| size = 4
}}
|
|
{{Datenbalken/bar
| color = red
| width = 80
| size = 4
}}
|
|
Bars can be "stacked," in vertical or horizontal charts, simply by listing them consecutively.
{{Datenbalken/bar|height=50|color=red}}
{{Datenbalken/bar|height=30|color=green}}
{{Datenbalken/bar|height=40|color=blue}}
|
|
|
{{Datenbalken/bar|width=50|color=red}}
{{Datenbalken/bar|width=30|color=green}}
{{Datenbalken/bar|width=40|color=blue}}
|
|
|
Labels can be applied to bars using the parameters label and/or value and/or name.
A label is applied below the bar.
{{Datenbalken/bar
| label = Oranges
| height = 80
}}
|
|
{{Datenbalken/bar
| label = Apples
| width = 80
}}
|
|
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.
{{Datenbalken/bar
| height = 80
| label = Oranges
| value = 80,000
}}
|
|
{{Datenbalken/bar
| width = 80
| label = Apples
| value = 80,000
}}
|
|
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.
{|
|- style="vertical-align:bottom;"
| {{Datenbalken/bar | value = 80}}
| {{Datenbalken/bar | value = 23}}
| {{Datenbalken/bar | value = 42}}
| {{Datenbalken/bar | value = 13}}
| {{Datenbalken/bar | value = 66}}
|}
|
|
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.
{{Datenbalken/bar
| height = 80
| name = 80,000
}}
|
|
{{Datenbalken/bar
| width = 80
| name = 80,000
}}
|
|
A name, instead of a label, may be useful when stacking bars.
'''Apples'''
{{Datenbalken/bar
| height = 50
| color = red
| name = Florida
}}
{{Datenbalken/bar
| height = 80
| color = green
| name = California
}}
{{Datenbalken/bar
| height = 40
| color = blue
| name = Oregon
}}
|
Apples
|
|
But a stacked color key is usually better. (Notice how in the main stack only the bottom bar is given a label.)
{|
|- style="vertical-align:top;"
|<!-----------------------
-- stack of bars --
------------------------->
{{Datenbalken/bar|height=50|color=red }}
{{Datenbalken/bar|height=80|color=green }}
{{Datenbalken/bar|height=40|color=blue|label='''Apples'''}}
|<!----------------------
-- color key --
------------------------>
{{Datenbalken/bar|color=red |name=Florida }}
{{Datenbalken/bar|color=green |name=California}}
{{Datenbalken/bar|color=blue |name=Oregon }}
|}
|
|
|
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.
{{Datenbalken/bar| width = 50| color = red | name = Florida | title = 50}}
{{Datenbalken/bar| width = 80| color = green | name = California| title = 80}}
{{Datenbalken/bar| width = 40| color = blue | name = Oregon | title = 40}}
|
|
This may be especially handy in a color key, to display totals, for example.
{{Datenbalken/bar|color=red |name=Florida | title = 5000}}
{{Datenbalken/bar|color=green |name=California| title = 8000}}
{{Datenbalken/bar|color=blue |name=Oregon | title = 4000}}
|
|
Alternatively, a title can be appended parenthetically to a name by setting a parameter called detailed.
If you are creating a template, such as Datenbalken, 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.
{{Datenbalken/bar|color=red |name=Florida | title = 7000| detailed=true}}
{{Datenbalken/bar|color=green |name=California| title = 8000| detailed=true}}
{{Datenbalken/bar|color=blue |name=Oregon | title = 6000| detailed=true}}
|
|