This site is supported by donations to The OEIS Foundation.

Template:Bar graph/bar

From OeisWiki
Jump to: navigation, search

The {{Bar graph/bar}} bar chart template is used to create horizontal bars for a horizontal bar graph produced with the {{Bar graph}} template.

Usage

{{Bar graph/bar|data|total|comment = comment|width = width|width_units = width_units|color = color|bar_border_color = bar_border_color|box_border_color = box_border_color}}
  • width is a number which determines the maximum width of the bar.
  • width_units are the units associated with the width (em, px, or %). The default is em.
  • data and total are used to determine the width of the bar using data/total to compute a percentage of width.
  • data is also used for the label on each bar.
  • comment is optional (if given, written to the right of data, comment between parentheses.)
  • color is used to override the default bar color (rgb(206, 223, 242), i.e.    .)
  • bar_border_color is an optional color for a 1px bar border (no bar border if not given)
  • box_border_color is an optional color for a 1px box border (no box border if not given) (the box corresponds to a 100% full bar)

Examples

Examples without borders

{{Bar graph/bar|1000|1000|width = 50|width_units = em}}
1,000
{{Bar graph/bar|700|1000|comment = seven hundred|width = 50|width_units = em|color = red}}
700(seven hundred)
{{Bar graph/bar|350|1000|width = 50|width_units = em|color = red}}
350
{{Bar graph/bar|1.25|2.5|width = 50|width_units = em|color = yellow}}
1.25


Examples with bar border (using bar_border_color)

{{Bar graph/bar|1000|1000|width = 50|width_units = em|bar_border_color = black}}
1,000
{{Bar graph/bar|700|1000|comment = seven hundred|width = 50|width_units = em|color = red|bar_border_color = black}}}}
700(seven hundred)
{{Bar graph/bar|350|1000|width = 50|width_units = em|color = red|bar_border_color = black}}}}
350
{{Bar graph/bar|1.25|2.5|width = 50|width_units = em|color = yellow|bar_border_color = red}}}}
1.25


Examples with box border (using box_border_color) with shows the maximal potential length of the bar (100%)

{{Bar graph/bar|1000|1000|width = 50|width_units = em|box_border_color = black}}
1,000
{{Bar graph/bar|700|1000|comment = seven hundred|width = 50|width_units = em|color = red|box_border_color = black}}
700(seven hundred)
{{Bar graph/bar|350|1000|width = 50|width_units = em|color = red|box_border_color = black}}
350
{{Bar graph/bar|1.25|2.5|width = 50|width_units = em|color = yellow|box_border_color = red}}
1.25


Examples with currently invalid input: negative value for data, shows no bar (leftward bar not yet implemented)

{{Bar graph/bar|-350|1000|width = 50|width_units = em|color = red}}
-350

See also