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 padding
5
chart.padding([10, 30, 30, 30]);
6
7
// set chart title text settings
8
chart.title('Eisenhower Matrix');
9
10
// set legend settings
11
chart.legend().enabled(true).padding([0, 0, 30, 0]).margin(0);
12
13
// The data used in this sample can be obtained from the CDN
14
// https://cdn.anychart.com/samples/quadrant-charts/eisenhower-matrix/data.js
15
// create series with data
16
var series1 = chart.marker(
17
// eslint-disable-next-line no-undef
18
anychart.data.set(getFamilyBusinessData()).mapAs({
19
x: 'urgent',
20
value: 'important'
21
})
22
);
23
series1
24
.name('Family')
25
.stroke('2px #fff')
26
.type('circle')
27
.size(8)
28
.selectionMode('none')
29
.legendItem({ iconType: 'circle' });
30
31
// The data used in this sample can be obtained from the CDN
32
// https://cdn.anychart.com/samples/quadrant-charts/eisenhower-matrix/data.js
33
var series2 = chart.marker(
34
// eslint-disable-next-line no-undef
35
anychart.data.set(getWorkBusinessData()).mapAs({
36
x: 'urgent',
37
value: 'important'
38
})
39
);
40
series2
41
.name('Business')
42
.stroke('2px #fff')
43
.type('circle')
44
.size(8)
45
.selectionMode('none')
46
.legendItem({ iconType: 'circle' });
47
48
// set chart labels settings
49
chart
50
.labels()
51
.enabled(true)
52
.fontFamily('Arial')
53
.position('right')
54
.anchor('left-center')
55
.offsetX(8)
56
.offsetY(0)
57
.format('{%Name}');
58
59
// set tooltip format
60
chart.tooltip().format('{%Description}');
61
62
// set quarters settings
63
chart.quarters({
64
rightTop: {
65
fill: '#fff',
66
title: {
67
useHtml: true,
68
fontSize: 12,
69
lineHeight: 1.2,
70
text:
71
'Urgent and important<br><span style="color: #2d4053;">DO IMMEDIATELY</span>',
72
background: {
73
fill: '#ECECEC',
74
stroke: anychart.color.darken('#ECECEC', 0.2)
75
},
76
fontColor: '#929292',
77
padding: [5, 10]
78
}
79
},
80
rightBottom: {
81
title: {
82
useHtml: true,
83
fontSize: 12,
84
lineHeight: 1.2,
85
text:
86
'Urgent, not important<br><span style="color: #2d4053;">DELEGATE</span>',
87
background: {
88
fill: '#ECECEC',
89
stroke: anychart.color.darken('#ECECEC', 0.2)
90
},
91
fontColor: '#929292',
92
padding: [5, 10]
93
}
94
},
95
leftTop: {
96
title: {
97
useHtml: true,
98
fontSize: 12,
99
lineHeight: 1.2,
100
text:
101
'Important, but not urgent<br><span style="color: #2d4053;">DECIDE WHEN WILL DO</span>',
102
background: {
103
fill: '#ECECEC',
104
stroke: anychart.color.darken('#ECECEC', 0.2)
105
},
106
fontColor: '#929292',
107
padding: [5, 10]
108
}
109
},
110
leftBottom: {
111
fill: '#fff',
112
title: {
113
useHtml: true,
114
fontSize: 12,
115
lineHeight: 1.2,
116
text:
117
'Not important, not urgent<br><span style="color: #2d4053;">DO LATER</span>',
118
background: {
119
fill: '#ECECEC',
120
stroke: anychart.color.darken('#ECECEC', 0.2)
121
},
122
fontColor: '#929292',
123
padding: [5, 10]
124
}
125
}
126
});
127
128
// set chart container id
129
chart.container('container');
130
// initiate chart drawing
131
chart.draw();
132
});