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
// create a data set
4
var data = anychart.data.set([
5
["January", 0.7, 6.1, 6.1, 12.6],
6
["February", 0.6, 6.3, 6.3, 12.2],
7
["March", 1.9, 8.5, 8.5, 13.1],
8
["April", 3.1, 10.8, 10.8, 15.9],
9
["May", 5.7, 14.4, 14.4, 16.4]
10
]);
11
12
// map the data
13
var seriesData_1 = data.mapAs({x: 0, low: 1, high: 2});
14
var seriesData_2 = data.mapAs({x: 0, low: 3, high: 4});
15
16
// create a chart
17
var chart = anychart.bar();
18
19
// create the first series and set the data
20
var series1 = chart.rangeBar(seriesData_1);
21
22
// create the second series and set the data
23
var series2 = chart.rangeBar(seriesData_2);
24
25
// set the padding between bars
26
chart.barsPadding(-1);
27
28
// set the padding between bar groups
29
chart.barGroupsPadding(2);
30
31
// disable tooltipss
32
series1.tooltip().enabled(false);
33
series2.tooltip().enabled(false);
34
35
// set the chart title
36
chart.title("Range Bar Chart: Padding (Multiple Series)");
37
38
// set the container id
39
chart.container("container");
40
41
// initiate drawing the chart
42
chart.draw();
43
});