HTMLcopy
1
<div id="container"></div>
CSScopy
8
1
html,
2
body,
3
#container {
4
width: 100%;
5
height: 100%;
6
margin: 0;
7
padding: 0;
8
}
JavaScriptcopy
x
1
anychart.onDocumentReady(function () {
2
// create quadrant chart
3
var chart = anychart.quadrant();
4
// set chart title
5
chart.title('SWOT Analysis');
6
// set chart padding
7
chart.padding([20, 20, 40, 40]);
8
9
// set quarters settings
10
chart.quarters({
11
rightTop: {
12
fill: '#E6B80A'
13
},
14
rightBottom: {
15
fill: '#C24B51'
16
},
17
leftTop: {
18
fill: '#02757A'
19
},
20
leftBottom: {
21
fill: '#A3BB59'
22
}
23
});
24
25
// create first label for left top quarter
26
chart
27
.quarters()
28
.leftTop()
29
.label(0)
30
.enabled(true)
31
.fontColor('#fff')
32
.fontSize(15)
33
.width('90%')
34
.text(
35
'1) What are your strengths?\n' +
36
'2) What do you do better than others?\n' +
37
'3) What unique capabilities and resources do you possess?\n' +
38
'4) What do others perceive as your strengths?'
39
);
40
41
// create first label for right top quarter
42
chart
43
.quarters()
44
.rightTop()
45
.label(0)
46
.enabled(true)
47
.fontColor('#fff')
48
.fontSize(15)
49
.width('90%')
50
.text(
51
'1) What are your weaknesses?\n' +
52
'2) What do your competitors do better than you?\n' +
53
'3) What can you improve given the current situation?\n' +
54
'4) What do others perceive as your weaknesses?'
55
);
56
57
// create first label for left bottom quarter
58
chart
59
.quarters()
60
.leftBottom()
61
.label(0)
62
.enabled(true)
63
.fontColor('#fff')
64
.fontSize(15)
65
.width('90%')
66
.text(
67
'1) What trends or conditions may positively impact you?\n' +
68
'2) What opportunities are available to you?'
69
);
70
71
// create first label for right bottom quarter
72
chart
73
.quarters()
74
.rightBottom()
75
.label(0)
76
.enabled(true)
77
.fontColor('#fff')
78
.fontSize(15)
79
.width('90%')
80
.text(
81
'1) What trends or conditions may negatively impact you?\n' +
82
'2) What are your competitors doing that may impact you?\n' +
83
'3) Do you have solid financial support?\n' +
84
'4) What impact do your weaknesses have on the threats to you?'
85
);
86
87
// create second label for left top quarter
88
chart
89
.quarters()
90
.leftTop()
91
.label(1)
92
.enabled(true)
93
.fontColor('#7c868e')
94
.fontSize(17)
95
.position('left-center')
96
.rotation(-90)
97
.offsetX(-20)
98
.text('Internal');
99
100
// create second label for left bottom quarter
101
chart
102
.quarters()
103
.leftBottom()
104
.label(1)
105
.enabled(true)
106
.fontColor('#7c868e')
107
.fontSize(17)
108
.position('left-center')
109
.rotation(-90)
110
.offsetX(-20)
111
.text('External');
112
113
// create third label for left bottom quarter
114
chart
115
.quarters()
116
.leftBottom()
117
.label(2)
118
.enabled(true)
119
.fontColor('#7c868e')
120
.fontSize(17)
121
.position('center-bottom')
122
.offsetY(20)
123
.text('Favourable');
124
125
// create second label for right bottom quarter
126
chart
127
.quarters()
128
.rightBottom()
129
.label(1)
130
.enabled(true)
131
.fontColor('#7c868e')
132
.fontSize(17)
133
.position('center-bottom')
134
.offsetY(20)
135
.text('Unfavourable');
136
137
// set chart container id
138
chart.container('container');
139
// initiate chart drawing
140
chart.draw();
141
});