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 data set on our data
3
var 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
28
.labels()
29
.enabled(true)
30
.fontColor('#60727b')
31
.position('center-top')
32
.anchor('center-bottom')
33
.format('${%Value}{groupsSeparator: }');
34
chart.hovered().labels(false);
35
36
// turn on legend
37
chart.legend().enabled(true).fontSize(13).padding([0, 0, 20, 0]);
38
39
// set interactivity settings
40
chart.interactivity().hoverMode('single');
41
42
// set tooltip settings
43
chart
44
.tooltip()
45
.positionMode('point')
46
.position('center-top')
47
.anchor('center-bottom')
48
.offsetX(0)
49
.offsetY(5)
50
.format('{%SeriesName}: ${%Value}{groupsSeparator: }');
51
52
// set container id for the chart
53
chart.container('container');
54
55
// initiate chart drawing
56
chart.draw();
57
});