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 column chart
3
var chart = anychart.column();
4
5
var dataSet = anychart.data.set([
6
['Lip gloss', 22998, 12043],
7
['Eyeliner', 12321, 15067],
8
['Eyeshadows', 12998, 12043],
9
['Powder', 10261, 14419],
10
['Mascara', 11261, 10419]
11
]);
12
13
// set chart title
14
chart.title('Rounded column sample');
15
16
var seriesData_one = dataSet.mapAs({x: 0, value: 1});
17
var seriesData_two = dataSet.mapAs({x: 0, value: 2});
18
19
// create first series with mapped data
20
var series_one = chart.column(seriesData_one);
21
series_one.name('Florida');
22
23
// set rendering settings
24
series_one.rendering().point(drawer);
25
26
var series_two = chart.column(seriesData_two);
27
series_two.name('Texas');
28
// set rendering settings
29
series_two.rendering().point(drawer);
30
31
// set container id for the chart and initiate chart drawing
32
chart.container('container').draw();
33
});
34
35
function drawer() {
36
// if missing (not correct data), then skipping this point drawing
37
if (this.missing) {
38
return;
39
}
40
41
// get shapes group
42
var shapes = this.shapes || this.getShapesGroup(this.pointState);
43
// calculate the left value of the x-axis
44
var leftX = this.x - this.pointWidth / 2;
45
// calculate the right value of the x-axis
46
var rightX = leftX + this.pointWidth;
47
// calculate the half of point width
48
var rx = this.pointWidth / 2;
49
50
shapes['path']
51
// resets all 'line' operations
52
.clear()
53
// draw column with rounded edges
54
.moveTo(leftX, this.zero)
55
.lineTo(leftX, this.value + rx)
56
.circularArc(leftX + rx, this.value + rx, rx, rx, 180, 180)
57
.lineTo(rightX, this.zero)
58
// close by connecting the last point with the first straight line
59
.close();
60
}