![]() | This is a documentation subpage for Module:Chart. It may contain usage information, categories and other content that is not part of the original module page. |
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", and adding "units suffix" for good measure:
{{ #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 | units suffix = Kg | x legends = Before : During : After : Post mortem }}
25
50
75
100
125
150
Before
During
After
Post mortem
- Apple
- Banana
- Orange
It is possible to show each of the groups using different scale and units:
{{ #invoke:Chart | bar-chart | width = 800 | group 1 = 1500000 : 2500000 : 3500000 | group 2 = 200 : 5000 : 20000 | group 3 = 2000 : 5000 : 20000 | colors = red : blue : green | group names = People : Cars : Average car cost | x legends = 1920 : 1965 : 2002 | units prefix = : : $ | scale per group = 1 }}
1,000,000
2,000,000
3,000,000
4,000,000
5,000
10,000
15,000
20,000
5,000
10,000
15,000
20,000
1920
1965
2002
- People
- Cars
- Average car cost