Jump to content

User:Shattered Gnome/sandbox

From Wikipedia, the free encyclopedia

This file is a testbed for a new revision of {{Module:Chart}} that is found at {{Module:Chart/sandbox}}

Source Result
Basic Bar graph
{{ #invoke:Chart/sandbox | bar chart
| group 1 = 40 : 50 : 60 : 20
| group 2 = 20 : 60 : 12 : 44
| group 3 = 55 : 14 : 33 : 5
| links 1 = Apple : McIntosh : Golden delicious
| links 2 = Banana : Apricot : Peach
| links 3 = Orange : Pear : Bear
| tooltip 2 = tooltip 1 : tooltip 2 : tooltip 3 : tooltip 4
| colors = green : yellow : orange
| group names = Apple : Banana : Orange
| x legends = Before : During : After : Postmortem
}}

tooltip 1
tooltip 2
tooltip 3
10
20
30
40
50
60
Before
During
After
Postmortem
  •   Apple
  •   Banana
  •   Orange
Stacked Bar graph
{{ #invoke:Chart/sandbox | 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 : Postmortem
}}

25
50
75
100
125
150
Before
During
After
Postmortem
  •   Apple
  •   Banana
  •   Orange
Scale per group

Notice the "units prefix" field: we do not need prefix for the first 2 groups, so we use colons with no content. we could write "::$" instead of " : : $". Also note the special tooltip for the "Cars" number for 1965.

{{ #invoke:Chart/sandbox | bar chart
| width = 800
| group 1 = 1500000 : 2500000 : 3500000
| group 2 = 200 : 5000 : 45000
| group 3 = 2000 : 5000 : 20000
| colors = red : blue : green
| group names = People : Cars : Average car cost
| x legends = 1920 : 1965 : 2002
| tooltip 2 = : There is no good data for number of cars in 1965.
we use 5,000 as best estimate
| units prefix = : : $
| scale per group = 1
}}

1,000,000
2,000,000
3,000,000
4,000,000
10,000
20,000
30,000
40,000
50,000
5,000
10,000
15,000
20,000
1920
1965
2002
  •   People
  •   Cars
  •   Average car cost
Here is an example with large number of groups - mainly to test how does it look with large number of legends.
{{ #invoke:Chart/sandbox | bar chart
| width = 800
| height = 550
| group 1 = 1:2:3:4:5:4:3:2:1
| group 2 = 1:2:3:4:5:4:3:2:1
| group 3 = 1:2:3:4:5:4:3:2:1
| group 4 = 1:2:3:4:5:4:3:2:1
| group 5 = 1:2:3:4:5:4:3:2:1
| group 6 = 1:2:3:4:5:4:3:2:1
| group 7 = 1:2:3:4:5:4:3:2:1
| group 8 = 1:2:3:4:5:4:3:2:1
| group 9 = 1:2:3:4:5:4:3:2:1
| group 10 = 1:2:3:4:5:4:3:2:1
| group 11 = 1:2:3:4:5:4:3:2:1
| group 12 = 1:2:3:4:5:4:3:2:1
| group 13 = 1:2:3:4:5:4:3:2:1
| group 14 = 1:2:3:4:5:4:3:2:1
| group 15 = 1:2:3:4:5:4:3:2:1
| group 16 = 1:2:3:4:5:4:3:2:1
| group 17 = 1:2:3:4:5:4:3:2:1
| group 18 = 1:2:3:4:5:4:3:2:1
| group 19 = 1:2:3:4:5:4:3:2:1
| group 20 = 1:2:3:4:5:4:3:2:1
| group 21 = 1:2:3:4:5:4:3:2:1
| colors = Silver:Gray:Black:Red:Maroon:Yellow:Olive:
Lime:Green:Aqua:Teal:Blue:Navy:Fuchsia:Purple:ForestGreen:
Tomato:LightSeaGreen:RosyBrown:DarkOliveGreen:MediumVioletRed
| group names = Alabama:Alaska:Arizona:Arkansas:California:
Colorado:Connecticut:Delaware:Florida:Georgia:Hawaii:Idaho:Illinois
:Indiana:Iowa:Kansas:Kentucky:Louisiana:Maine:Maryland:Massachusetts
| x legends = 1920 : 1930 : 1940: 1950 : 1960 : 1970 : 1990 : 2000 : 2010
| units prefix = $
| units suffix = _Billion
| stack = 1
}}

25
50
75
100
125
150
1920
1930
1940
1950
1960
1970
1990
2000
2010
  •   Alabama
  •   Alaska
  •   Arizona
  •   Arkansas
  •   California
  •   Colorado
  •   Connecticut
  •   Delaware
  •   Florida
  •   Georgia
  •   Hawaii
  •   Idaho
  •   Illinois
  •   Indiana
  •   Iowa
  •   Kansas
  •   Kentucky
  •   Louisiana
  •   Maine
  •   Maryland
  •   Massachusetts
x legends can be diluted by using delimiters with nothing in between
{{ #invoke:Chart/sandbox | bar chart
| group 1 = 1:2:3:4:5:6:7:8:9:10:11:12:13:14:15:16:17:18:19:20:
21:22:23:24:25:26:27:28:29:30:31:32:33:34:35:36:37:38:39:40
:41:42:43:44:45:46:47:48:49:50:51:52:53:54:55:56:57:58:59
| units suffix = _Things
| group names = Some
| x legends = ::::1940::::::::::1950::::::::::
1960::::::::::1970::::::::::1980::::::::::1990::::
}}

10
20
30
40
50
60
1940
1950
1960
1970
1980
1990
pie chart
{{#invoke:Chart/sandbox |pie chart
| radius = 150
| slices = 
    ( 1000000 : Apples ) 
    ( 2000000 : Bananas  : gold) 
    ( 1440000 : Apricots ) 
    ( 6.4e5 : Pears : : [[Pear|Pears]] )
    ( 750,000 : Pineapples )
| units suffix = _Tonne
| percent = true
}}

Apples: 1,000,000 Tonne (17.2%)Bananas: 2,000,000 Tonne (34.3%)Apricots: 1,440,000 Tonne (24.7%)PearsPineapples: 750,000 Tonne (12.9%)
  •   Apples: 1,000,000 Tonne (17.2%)
  •   Bananas: 2,000,000 Tonne (34.3%)
  •   Apricots: 1,440,000 Tonne (24.7%)
  •   Pears: 640,000 Tonne (11.0%)
  •   Pineapples: 750,000 Tonne (12.9%)
alternative syntax with "slice 1", "slice 2" etc.
{{#invoke:chart/sandbox |pie chart
|radius= 200
|units suffix = _Units
| slice 1 = 1 : 1
| slice 2 = 7 : 7
| slice 3 = 8 : 8
| slice 4 = 9 : 9
| slice 5 = 10 : 10
| slice 6 = 11 : 11
| slice 7  = 12 : 12
| slice 8  = 13 : 13
| slice 9  = 14 : 14
| slice 10 = 15 : 15
| slice 11 = 16 : 16
| slice 12 = 17 : 17
| slice 13 = 18 : 18
| slice 14 = 19 : 19
| slice 15 = 20 : 20
| slice 16 = 21 : 21
| slice 17 = 22 : 22
| slice 18 = 23 : 23
| slice 19 = 24 : 24
| slice 20 = 25 : 25
| slice 21 = 26 : 26
| slice 22 = 27 : 27
| slice 23 = 28 : 28
| slice 24 = 29 : 29
| slice 25 = 30 : 30
| slice 26 = 31 : 31
| percent = true
}}

1: 1 Units (0.2%)7: 7 Units (1.5%)8: 8 Units (1.7%)9: 9 Units (1.9%)10: 10 Units (2.1%)11: 11 Units (2.3%)12: 12 Units (2.5%)13: 13 Units (2.7%)14: 14 Units (2.9%)15: 15 Units (3.2%)16: 16 Units (3.4%)17: 17 Units (3.6%)18: 18 Units (3.8%)19: 19 Units (4.0%)20: 20 Units (4.2%)21: 21 Units (4.4%)22: 22 Units (4.6%)23: 23 Units (4.8%)24: 24 Units (5.0%)25: 25 Units (5.3%)26: 26 Units (5.5%)27: 27 Units (5.7%)28: 28 Units (5.9%)29: 29 Units (6.1%)30: 30 Units (6.3%)31: 31 Units (6.5%)
  •   1: 1 Units (0.2%)
  •   7: 7 Units (1.5%)
  •   8: 8 Units (1.7%)
  •   9: 9 Units (1.9%)
  •   10: 10 Units (2.1%)
  •   11: 11 Units (2.3%)
  •   12: 12 Units (2.5%)
  •   13: 13 Units (2.7%)
  •   14: 14 Units (2.9%)
  •   15: 15 Units (3.2%)
  •   16: 16 Units (3.4%)
  •   17: 17 Units (3.6%)
  •   18: 18 Units (3.8%)
  •   19: 19 Units (4.0%)
  •   20: 20 Units (4.2%)
  •   21: 21 Units (4.4%)
  •   22: 22 Units (4.6%)
  •   23: 23 Units (4.8%)
  •   24: 24 Units (5.0%)
  •   25: 25 Units (5.3%)
  •   26: 26 Units (5.5%)
  •   27: 27 Units (5.7%)
  •   28: 28 Units (5.9%)
  •   29: 29 Units (6.1%)
  •   30: 30 Units (6.3%)
  •   31: 31 Units (6.5%)