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