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
// create data set on our data
3
chartData = {
4
title: 'Top 3 Products with Region Sales Data',
5
header: ['#', 'Florida', 'Texas', 'Arizona', 'Nevada'],
6
rows: [
7
['Nail polish', 6814, 3054, 4376, 4229],
8
['Eyebrow pencil', 7012, 5067, 8987, 3932],
9
['Lipstick', 8814, 9054, 4376, 9256]
10
]
11
};
12
13
// create column chart
14
var chart = anychart.column3d();
15
16
// set chart data
17
chart.data(chartData);
18
19
// turn on chart animation
20
chart.animation(true);
21
22
// set axes settings
23
chart.yAxis().title('Revenue in Dollars');
24
chart.yAxis().labels().format('{%Value}{groupsSeparator: }');
25
26
// set labels settings
27
chart.labels()
28
.enabled(true)
29
.fontColor('#60727b')
30
.position('center-top')
31
.anchor('center-bottom')
32
.format('${%Value}{groupsSeparator: }');
33
chart.hovered().labels(false);
34
35
// turn on legend
36
chart.legend()
37
.enabled(true)
38
.fontSize(13)
39
.padding([0, 0, 20, 0]);
40
41
// set interactivity settings
42
chart.interactivity().hoverMode('single');
43
44
// set tooltip settings
45
chart.tooltip()
46
.positionMode('point')
47
.position('center-top')
48
.anchor('center-bottom')
49
.offsetX(0)
50
.offsetY(5)
51
.format('{%SeriesName}: ${%Value}{groupsSeparator: }');
52
53
// set container id for the chart
54
chart.container('container');
55
56
// initiate chart drawing
57
chart.draw();
58
});