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 column chart
3
var chart = anychart.column3d();
4
5
// turn on chart animation
6
chart.animation(true);
7
8
// set chart title text settings
9
chart.title('Top 10 Cosmetic Products by Revenue');
10
11
// create area series with passed data
12
chart.column([
13
['Rouge', '80540'],
14
['Foundation', '94190'],
15
['Mascara', '102610'],
16
['Lip gloss', '110430'],
17
['Lipstick', '128000'],
18
['Nail polish', '143760'],
19
['Eyebrow pencil', '170670'],
20
['Eyeliner', '213210'],
21
['Eyeshadows', '249980']
22
]);
23
24
chart
25
.tooltip()
26
.position('center-top')
27
.anchor('center-bottom')
28
.offsetX(0)
29
.offsetY(5)
30
.format('${%Value}');
31
32
// set scale minimum
33
chart.yScale().minimum(0);
34
35
// set yAxis labels formatter
36
chart.yAxis().labels().format('{%Value}{groupsSeparator: }');
37
38
chart.tooltip().positionMode('point');
39
chart.interactivity().hoverMode('by-x');
40
41
chart.xAxis().title('Products by Revenue');
42
chart.yAxis().title('Revenue in Dollars');
43
44
// set container id for the chart
45
chart.container('container');
46
47
// initiate chart drawing
48
chart.draw();
49
});