Module:Chart/doc

This is an old revision of this page, as edited by קיפודנחש (talk | contribs) at 20:12, 30 March 2013 (more appropriate colors?). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Char module currently has a single function: bar-chart.

parameters to this function are:

parameter name what it does
delimiter string to delimit multiple values when given. default to colon ( : ). normally you do not want to touch this, it's provided for the off-chance you'll want to use colon as part of one of the parameters.
width number. if provided, must be at least 200. default: 500
height number. if provided, must be at least 200. default: 350
group n (where "n" is a number. use "group 1", "group 2" etc. for as many groups as there are in the graph) the values to be charted. see below.
stack whether to stack the different groups on top of each other. do not specify to show bars side by side.
colors the colors used to denote the various groups. should have exactly as many values as # of groups. can be given as standard html-recognized color names, or using #xxx or #xxxxxx notation.
x legends The legends for the X values
tooltip n tooltip to be associated with specific bar
default color default color for the bars, if all to be drawn with same color. defaults to blue.
scale per group set to 1 to use separate Y- scale for each group. leave empty to use one scale for all groups. incompatible with "stack"
units prefix used in tooltip. e.g., $, so values will show as $500 instead of 500 in tooltips
units suffix ditto for unitst suffix. use, e.g. "Kg" so values will show as 88Kg instead of 88 in tooltip
group names names of different groups

many of the parameters are multi-valued, and are delimited with "delimiter"

some simple examples:

{{ #invoke:Chart | bar-chart
| group 1 = 40 : 50 : 60 : 20
| group 2 = 20 : 60 : 12 : 44
| group 3 = 55 : 14 : 33 : 5
| colors = green : yellow : orange
| group names = Apple : Banana : Orange
| x legends = Before : During : After : Post mortem
}}


10
20
30
40
50
60
Before
During
After
Post mortem
  •   Apple
  •   Banana
  •   Orange


Here is the same graph, with more modest height and width, using "stack":

{{ #invoke:Chart | bar-chart
| height = 250
| width = 300
| stack = 1
| group 1 = 40 : 50 : 60 : 20
| group 2 = 20 : 60 : 12 : 44
| group 3 = 55 : 14 : 33 : 5
| colors = green : yellow : orange
| group names = Apple : Banana : Orange
| x legends = Before : During : After : Post mortem
}}
25
50
75
100
125
150
Before
During
After
Post mortem
  •   Apple
  •   Banana
  •   Orange