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().text("The Main Armed Forces").padding(0).height(0).margin(0).fontSize(10);
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.margin(-10, -10, -10, -10);
22
pie.draw();
23
24
var column = anychart.column();
25
26
// set title
27
column.title().text("The Forces Of Light").padding(2).margin(5);
28
29
// set axes titles
30
column.xAxis().title().text("Military Unit").fontSize(10).padding(0).height(2);
31
column.yAxis().title().text("Amount").fontSize(10).padding(0).height(0).margin(0);
32
33
// set scale minimum
34
column.yScale().minimum(0);
35
36
// set data
37
var series = column.column([
38
{"x": "Men of Esgaroth", value: 2709, stroke:{color:"#CD7F32", thickness:"2"}},
39
{"x": "Eagles", value: 1067, stroke:{color:"#157DEC", thickness:"2"}},
40
{"x": "Elves", value: 1015, stroke:{color:"#008000", thickness:"2"}},
41
{"x": "Dwarves Of The Iron Hills", value: "500", stroke:{color:"#808080", thickness:"2"}},
42
{"x": "Thirteen Lions of Erebor", value: 13, stroke:{color:"#C0C0C0", thickness:"2"}},
43
{"x": "Beorn", value: 1, marker:{type:"star5", fill:"gold", size: 6, enabled: true}},
44
{"x": "Gandalf the Grey", fill:{color:"#726E6D"}, value: 1, marker:{type:"star5", fill:"#FDD017", size: 9, enabled: true}, hoverMarker: {size: 12}},
45
{"x":"Bilbo Baggins", value: 1, marker:{type:"star5", fill:"#EAC117", size: 6, enabled: true}}
46
]);
47
48
49
column.xAxis().staggerMode(true);
50
51
column.yScale(anychart.scales.log());
52
column.bounds("0%", "50%", "100%", "50%");
53
column.container(stage);
54
column.margin(-10, -10, -10, -10);
55
column.draw();
56
57
var scatterChart = anychart.scatterChart();
58
59
// set title
60
scatterChart.title().text("Key Points Of The Battle").padding(0).margin(0);
61
62
// draw axes and set titles
63
scatterChart.xAxis().title().text("The Battle Duration (Minutes)").fontSize(10).padding(0).height(0);
64
scatterChart.yAxis().title().text("Enemies Amount").fontSize(10).padding(0).height(0).margin(0);
65
66
// draw grid
67
scatterChart.grid().layout("horizontal");
68
69
// draw minor grid and adjust
70
scatterChart.minorGrid()
71
.evenFill("none")
72
.oddFill("none")
73
.stroke("black 0.075")
74
.layout("vertical");
75
76
// data
77
data = anychart.data.set([
78
{x: "147", value: 10005, point:"Appearance Of The Eagles"},
79
{x: "170", value: 9000, point:"Thorin Makes Blade Rush"},
80
{x: "236", value: 5011, point:"Gandalf's Mighty Fireball"},
81
{x: "277", value: 237, point:"Thranduil's Powerful Attack"}
82
]);
83
84
var view = data.mapAs();
85
// set data
86
var scatterSeries = scatterChart.line(data);
87
scatterSeries.tooltip().enabled(false);
88
scatterSeries.labels().enabled(true).fontSize(9).format(function(){
89
return view.get(
90
this.index, "point"
91
)});
92
93
// set color
94
scatterSeries.fill("#C6D1A5");
95
scatterChart.bounds("20%", "0%", "80%", "50%");
96
scatterChart.container(stage);
97
scatterChart.margin(-10, -15, -10, -15);
98
scatterChart.draw();
99
100
});