HTMLcopy
1
<div id="container"></div>
2
<div id="bottom">Data source: <a href="http://eng.ombudsman-dnr.ru/">Human Rights Ombudsman in the DPR</a></div>
CSScopy
12
1
html,
2
body,
3
#container {
4
width: 100%;
5
height: 98%;
6
margin: 0;
7
padding: 0;
8
}
9
#bottom {
10
font-size: 12px;
11
margin-left: 15px;
12
}
JavaScriptcopy
x
1
anychart.onDocumentReady(function () {
2
3
// data
4
var dataSet = anychart.data.set([
5
['2014', null, 2546],
6
['2015', null, 1395],
7
['2016', null, 348],
8
['2017', null, 278],
9
['2018', null, 154],
10
['2019', null, 160],
11
['2020', null, 44],
12
['2021', null, 77],
13
['2022*', 1810, 4]
14
]);
15
16
// data mapping
17
var firstSeriesData = dataSet.mapAs({ x: 0, value: 1 });
18
var secondSeriesData = dataSet.mapAs({ x: 0, value: 2 });
19
20
// column chart instance
21
var chart = anychart.column();
22
23
// value stacking
24
chart.yScale().stackMode('value');
25
26
// series
27
series1 = chart.column(firstSeriesData);
28
series1.name('Deaths from week Feb 18-25 to week Apr 15-21, 2022').color('LightGray').hatchFill("backwardDiagonal");
29
series2 = chart.column(secondSeriesData);
30
series2.name('Deaths before week Feb 18-25, 2022').color('Crimson');
31
32
// y scale maximum
33
chart.yScale().minimum(0).maximum(2800);
34
35
// title
36
chart
37
.title()
38
.enabled(true)
39
.useHtml(true)
40
.text(
41
'<span style="color:#212121; font-size: 18px;"><strong>Deaths in the Donetsk People's Republic in 2014–2022</strong></span><br/>' +
42
'<span style="font-size: 14px;"><em>"The purpose of this operation is to protect people who, for eight years now, have been facing humiliation and genocide perpetrated by the Kyiv regime.</em>"<br>— Vladimir Putin (Feb 24, 2022)</span>'
43
)
44
.padding([0, 0, 20, 0]);
45
46
// tooltip
47
chart.tooltip().format(function(e){
48
if (e.x !== '2022*') {
49
return 'Deaths: ' + e.value;
50
}
51
else
52
{
53
return e.seriesName + ': ' + e.value;
54
}
55
});
56
57
// union tooltip
58
var tooltip = chart.tooltip();
59
tooltip.displayMode("union");
60
61
// chart labels
62
chart
63
.labels()
64
.enabled(true)
65
.position('center-top')
66
.anchor('center-bottom')
67
.format('{%Value}{groupsSeparator: }');
68
69
// axes titles
70
chart.yAxis().title('Deaths');
71
chart.xAxis().title('Year');
72
73
// legend
74
chart.legend(true);
75
chart.legend().inverted(true);
76
77
// container
78
chart.container('container');
79
80
// drawing
81
chart.draw();
82
83
});