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 = [
5
["P1", 16, 20],
6
["P2", 12, 18],
7
["P3", 9, 14]
8
];
9
10
// create stage
11
var stage = anychart.graphics.create("container");
12
13
// main title
14
var title = anychart.standalones.title();
15
title.parentBounds(0, 0, stage.width(), stage.height()*0.1);
16
title.text("Background Stroke Types");
17
title.container(stage);
18
title.draw();
19
20
21
// Chart with red solid stroke
22
var chart_1 = anychart.column();
23
24
// setting title
25
chart_1.title("Solid Stroke");
26
27
// setting stroke for chart contaoner. It has solid type by default
28
chart_1.background().stroke("5 red");
29
30
// setting position and bounds
31
chart_1.bounds(0, "10%", "45%", "40%");
32
33
// disabling titles, labels and all ticks for Axes
34
chart_1.yAxis(false);
35
chart_1.xAxis(false);
36
37
// setting data series
38
chart_1.data(data);
39
40
// set container and draw
41
chart_1.container(stage);
42
chart_1.draw();
43
44
45
// chart with gradient stroke
46
var chart_2 = anychart.column();
47
chart_2.title("Gradient Stroke");
48
chart_2.bounds("55%", "10%", "45%", "40%");
49
50
// adjust stroke type and set color keys
51
chart_2.background().stroke({
52
// set colors position
53
keys: [".1 red", ".5 yellow", ".9 blue"],
54
// set angle of colors drawing
55
angle: 45,
56
// set stroke thickness
57
thickness: 5
58
});
59
60
// disabling titles, labels and all ticks for Axes
61
chart_2.yAxis(false);
62
chart_2.xAxis(false);
63
64
// set series data
65
chart_2.data(data);
66
67
// set container and draw
68
chart_2.container(stage);
69
chart_2.draw();
70
71
72
// chart with dashed stroke
73
var chart_3 = anychart.column();
74
chart_3.title("Dashed Stroke");
75
chart_3.bounds(0, "60%", "45%", "40%");
76
77
// adjust stroke type and dash settings
78
chart_3.background().stroke({color: "red", dash: "5 2 5", thickness: 5});
79
80
// disable axes
81
chart_3.xAxis(false);
82
chart_3.yAxis(false);
83
84
chart_3.data(data);
85
86
chart_3.container(stage);
87
chart_3.draw();
88
89
90
// chat with disabled stroke
91
var chart_4 = anychart.column();
92
93
chart_4.title("Disabled Stroke");
94
chart_4.bounds("55%", "60%", "45%", "40%");
95
chart_4.background().stroke(null);
96
97
chart_4.xAxis(false);
98
chart_4.yAxis(false);
99
100
chart_4.data(data);
101
102
chart_4.container(stage);
103
chart_4.draw();
104
});