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
3
// data set
4
var data = anychart.data.set([
5
["P1", 16, 20],
6
["P2", 12, 18],
7
["P3", 9, 14]
8
]);
9
10
// map data for series
11
var seriesData_1 = data.mapAs({x: [0], value: [1]});
12
var seriesData_2 = data.mapAs({x: [0], value: [2]});
13
14
var stage = anychart.graphics.create("container");
15
16
// setting main title
17
var title = anychart.standalones.title();
18
title.parentBounds(0, 0, stage.width(), stage.height()*0.1);
19
title.text("Corners Types");
20
title.container(stage);
21
title.draw();
22
23
24
// Chart without background corners adjusting
25
var defaultCornersChart = anychart.column();
26
27
// setting title
28
defaultCornersChart.title("Default Corners");
29
30
// setting stroke for chart container
31
var defaultBackground = defaultCornersChart.background();
32
defaultBackground.stroke("3 red");
33
// set corner type
34
defaultBackground.cornerType("none");
35
// set corner radius
36
defaultBackground.corners(10);
37
38
// setting position and bounds
39
defaultCornersChart.bounds("1%", "10%", "48%", "44%");
40
41
// setting data into series
42
defaultCornersChart.column(seriesData_1);
43
defaultCornersChart.column(seriesData_2);
44
45
// draw container
46
defaultCornersChart.container(stage);
47
defaultCornersChart.draw();
48
49
50
// chart with round corners
51
var roundCornersChart = anychart.column();
52
roundCornersChart.title("Round Corners");
53
roundCornersChart.bounds("51%", "10%", "48%", "44%");
54
var roundBackground = roundCornersChart.background();
55
roundBackground.stroke("3 red");
56
// set corner type
57
roundBackground.cornerType("round");
58
roundBackground.corners(10, 0, 10, 0); // apply corner type only for top-left and bottom-right corners.
59
60
// set data
61
roundCornersChart.column(seriesData_1);
62
roundCornersChart.column(seriesData_2);
63
64
// draw chart
65
roundCornersChart.container(stage);
66
roundCornersChart.draw();
67
68
69
// chart with round inner background corners
70
var roundInnerCornersChart = anychart.column();
71
72
// chart title
73
roundInnerCornersChart.title("Round Inner Corners");
74
75
// chart size and position
76
roundInnerCornersChart.bounds("1%", "55%", "48%", "44%");
77
78
// adjust chart background
79
var innerBackground = roundInnerCornersChart.background();
80
// set stroke color and thickness
81
innerBackground.stroke("3 red");
82
// corner type
83
innerBackground.cornerType("roundInner");
84
// corner radius
85
innerBackground.corners(10);
86
87
// set data
88
roundInnerCornersChart.column(seriesData_1);
89
roundInnerCornersChart.column(seriesData_2);
90
91
// draw chart
92
roundInnerCornersChart.container(stage);
93
roundInnerCornersChart.draw();
94
95
96
// chat with labels inside
97
var cutCornerChart = anychart.column();
98
99
// chart title
100
cutCornerChart.title("Cut background Corner");
101
102
// chart size and position
103
cutCornerChart.bounds("51%", "55%", "48%", "44%");
104
105
// adjust background
106
var cutBackground = cutCornerChart.background();
107
// set background stroke color and thickness
108
cutBackground.stroke("3 red");
109
// set corner type
110
cutBackground.cornerType("cut");
111
// set corner radius and apply it only to top corners
112
cutBackground.corners(10, 10, 0, 0);
113
114
// setting data
115
cutCornerChart.column(seriesData_1);
116
cutCornerChart.column(seriesData_2);
117
118
// draw chart
119
cutCornerChart.container(stage);
120
cutCornerChart.draw();
121
});