HTMLcopy
1
<div id="container"></div>
CSScopy
6
1
html, body, #container {
2
width: 100%;
3
height: 100%;
4
margin: 0;
5
padding: 0;
6
}
JavaScriptcopy
x
1
anychart.onDocumentReady(function () {
2
3
// create stage for all charts
4
var stage = acgraph.create("container");
5
6
var pie = anychart.pie([
7
{"name":" Iron Hills - Dwarves", "value": 513, fill: {color:"Rgb(70,100,70)"}},
8
{"name":"Mirkwood - Elves", "value": 1015, fill: {color:"Rgb(77,180,77)"}},
9
{"name":"Esgaroth - Men", "value": 2709, fill: {color:"Rgb(77,150,77)"}},
10
{"name":"Orcs", "value": 6232, fill: {color:"Rgb(190,30,27)"}},
11
{"name":"Wargs", "value": 4707, fill: {color:"Rgb(190,30,47)"}},
12
]);
13
14
// set chart title text settings
15
pie.title("The Main Armed Forces");
16
17
// disabling legend title and title separator
18
pie.legend().enabled(false);
19
pie.bounds(0, 0, "20%", "50%");
20
pie.container(stage);
21
pie.draw();
22
23
var column = anychart.column();
24
25
// set title
26
column.title("The Forces Of Light");
27
28
// set axes titles
29
column.xAxis().title("Military Unit");
30
column.yAxis().title("Amount");
31
32
// set data
33
var series = column.column([
34
{"x": "Men of Esgaroth", value: 2709, stroke:{color:"#CD7F32", thickness:"2"}},
35
{"x": "Eagles", value: 1067, stroke:{color:"#157DEC", thickness:"2"}},
36
{"x": "Elves", value: 1015, stroke:{color:"#008000", thickness:"2"}},
37
{"x": "Dwarves Of The Iron Hills", value: "500", stroke:{color:"#808080", thickness:"2"}},
38
{"x": "Thirteen Lions of Erebor", value: 13, stroke:{color:"#C0C0C0", thickness:"2"}},
39
{"x": "Beorn", value: 1, marker:{type:"star5", fill:"gold", size: 6, enabled: true}},
40
{"x": "Gandalf the Grey", fill:{color:"#726E6D"}, value: 1, marker:{type:"star5", fill:"#FDD017", size: 9, enabled: true}, hoverMarker: {size: 12}},
41
{"x":"Bilbo Baggins", value: 1, marker:{type:"star5", fill:"#EAC117", size: 6, enabled: true}}
42
]);
43
44
column.xAxis().staggerMode(true);
45
46
column.yScale(anychart.scales.log());
47
column.bounds("0%", "50%", "100%", "50%");
48
column.container(stage);
49
column.draw();
50
51
var scatterChart = anychart.scatterChart();
52
53
// set title
54
scatterChart.title("Key Events Of The Battle");
55
56
// draw axes and set titles
57
scatterChart.xAxis("The Battle Duration (Minutes)");
58
scatterChart.yAxis("Enemies Amount");
59
60
// draw grid
61
scatterChart.yGrid(true);
62
63
// draw minor grid and adjust
64
scatterChart.yMinorGrid(true);
65
scatterChart.yMinorGrid().stroke("black 0.075")
66
67
// data
68
data = [
69
{x: "147", value: 10005, event: "Appearance Of The Eagles"},
70
{x: "170", value: 9000, event: "Thorin Makes Blade Rush"},
71
{x: "236", value: 5011, event: "Gandalf's Mighty Fireball"},
72
{x: "277", value: 237, event: "Thranduil's Powerful Attack"}
73
];
74
75
scatterChart.line(data);
76
scatterChart.labels().enabled(true);
77
scatterChart.labels().format("{%event}");
78
79
// set color
80
scatterChart.bounds("20%", "0%", "80%", "50%");
81
scatterChart.container(stage);
82
scatterChart.draw();
83
84
});