HTMLcopy
x
1
<button id="overall">Industry summary</button>
2
<button id="alignment">Alignment</button>
3
<button id="cost">Cost</button>
4
<button id="efficiency">Efficiency</button>
5
6
<div id="container"></div>
CSScopy
11
1
html,
2
body,
3
#container {
4
width: 95%;
5
height: 95%;
6
margin: 0;
7
padding: 0;
8
}
9
button {
10
margin: 10px 0 0 10px;
11
}
JavaScriptcopy
204
1
//create data for Summary
2
var summData1 = [
3
{x: "Alignment", value: 4.8},
4
{x: "Costs", value: 4.4},
5
{x: "Efficiency", value: 4.5},
6
{x: "Overall", value: 4.6},
7
];
8
9
var summData2 = [
10
{x: "Alignment", value: 4.3},
11
{x: "Costs", value: 3.3},
12
{x: "Efficiency", value: 4.6},
13
{x: "Overall", value: 4.2},
14
];
15
16
var summData3 = [
17
{x: "Alignment", value: 4.2},
18
{x: "Costs", value: 2.9},
19
{x: "Efficiency", value: 4.3},
20
{x: "Overall", value: 4.0},
21
];
22
23
//create data for Cost
24
var costData1 = [
25
{x: "Aggregate costs", value: 4.3},
26
{x: "-", value: 0},
27
{x: "Cost structure and transparency", value: 4.4},
28
{x: "~", value: 0},
29
];
30
31
var costData2 = [
32
{x: "Aggregate costs", value: 2.8},
33
{x: "-", value: 0},
34
{x: "Cost structure and transparency", value: 3.7},
35
{x: "~", value: 0},
36
];
37
38
var costData3 = [
39
{x: "Aggregate costs", value: 2.8},
40
{x: "-", value: 0},
41
{x: "Cost structure and transparency", value: 3},
42
{x: "~", value: 0},
43
];
44
45
//create data for Efficiency
46
var effData1 = [
47
{x: "AO organisational effectiveness", value: 5.1},
48
{x: "AM organisational effectiveness", value: 5.4},
49
{x: "Long-term effectiveness/sustainability", value: 3.7},
50
{x: "Value chain effectiveness", value: 3.7},
51
{x: "Effective regulation", value: 4.4},
52
];
53
54
var effData2 = [
55
{x: "AO organisational effectiveness", value: 4.4},
56
{x: "AM organisational effectiveness", value: 5.8},
57
{x: "Long-term effectiveness/sustainability", value: 3.9},
58
{x: "Value chain effectiveness", value: 3.8},
59
{x: "Effective regulation", value: 5},
60
];
61
62
var effData3 = [
63
{x: "AO organisational effectiveness", value: 3.9},
64
{x: "AM organisational effectiveness", value: 5.8},
65
{x: "Long-term effectiveness/sustainability", value: 3.8},
66
{x: "Value chain effectiveness", value: 3.5},
67
{x: "Effective regulation", value: 4.4},
68
];
69
70
//create data for Alignment
71
var alignData1 = [
72
{ x: 'Trust measures', value: 5.2},
73
{ x: 'Transparency', value: 5},
74
{ x: 'Ethical condition', value: 5.6},
75
{ x: 'Incentives structure', value: 4.4},
76
{ x: 'Culture', value: 4.9},
77
{ x: 'Society', value: 3.9}
78
];
79
80
var alignData2 = [
81
{ x: 'Trust measures', value: 4},
82
{ x: 'Transparency', value: 4.3},
83
{ x: 'Ethical condition', value: 5.2},
84
{ x: 'Incentives structure', value: 3.7},
85
{ x: 'Culture', value: 4.6},
86
{ x: 'Society', value: 3.9}
87
];
88
89
var alignData3 = [
90
{ x: 'Trust measures', value: 4.4},
91
{ x: 'Transparency', value: 4.2},
92
{ x: 'Ethical condition', value: 5},
93
{ x: 'Incentives structure', value: 3.5},
94
{ x: 'Culture', value: 4},
95
{ x: 'Society', value: 0}
96
];
97
98
anychart.onDocumentReady(function () {
99
// create polar chart
100
var chart = anychart.polar();
101
102
var columnSeries1 = chart.column(alignData1);
103
// set series name
104
columnSeries1.name('2023');
105
106
var columnSeries2 = chart.column(alignData2);
107
// set series name
108
columnSeries2.name('2018');
109
110
var columnSeries3 = chart.column(alignData3);
111
// set series name
112
columnSeries3.name('2015');
113
114
// adjust chart settings
115
var title = chart.title();
116
// enable title
117
title.enabled(true);
118
// set padding
119
title.padding(5);
120
// set title text
121
title.text("Investment industry scorecard 2023-2015");
122
title.fontSize(20).fontColor('black');
123
// settings for title background
124
var titleBackground = chart.title().background();
125
// enable background
126
titleBackground.enabled(true);
127
// set background inner color
128
titleBackground.fill("#FFD700");
129
// set background border
130
titleBackground.stroke("#D8D8D8");
131
// set type of background corners
132
titleBackground.cornerType("round");
133
// set corners size
134
titleBackground.corners(10);
135
136
// enable sorting points by x
137
chart.sortPointsByX(true);
138
139
// disable y-axis
140
chart.yAxis(false);
141
142
// set value prefix for tooltip
143
chart.tooltip().valuePrefix('Score:');
144
145
// set x-scale
146
chart.xScale('ordinal');
147
148
// set chart container id
149
chart.container('container');
150
151
// create the legend
152
chart.legend().enabled(true).itemsLayout('vertical').position('right').fontColor('black');
153
154
// configure the chart labels
155
var labels = chart.xAxis().labels();
156
labels.fontSize(20)
157
.fontColor('black');
158
159
// customize the series color
160
columnSeries1.color('#83B8AE');
161
columnSeries2.color('#DC911B');
162
columnSeries3.color('#DDD65A');
163
164
chart.padding(50, 0, 0, 0);
165
166
// initiate chart drawing
167
chart.draw();
168
169
170
//function for switching to "Industry summary"
171
var summary = function(){
172
columnSeries1.data(summData1);
173
columnSeries2.data(summData2);
174
columnSeries3.data(summData3);
175
}
176
//function for switching to "Alignment"
177
var alignment = function(){
178
columnSeries1.data(alignData1);
179
columnSeries2.data(alignData2);
180
columnSeries3.data(alignData3);
181
}
182
//function for switching to "Cost"
183
var cost = function(){
184
columnSeries1.data(costData1);
185
columnSeries2.data(costData2);
186
columnSeries3.data(costData3);
187
}
188
//function for switching to "Efficiency"
189
var efficiency = function(){
190
columnSeries1.data(effData1);
191
columnSeries2.data(effData2);
192
columnSeries3.data(effData3);
193
}
194
195
//register a click on an button and fire according function
196
document.getElementById("overall").addEventListener("click", summary);
197
document.getElementById("alignment").addEventListener("click", alignment);
198
document.getElementById("cost").addEventListener("click", cost)
199
document.getElementById("efficiency").addEventListener("click", efficiency)
200
201
202
});
203
204