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
var stage = anychart.graphics.create("container");
4
5
// chart with stagger mode
6
staggerLabels = anychart.column();
7
staggerLabels.title("Hiding the First and the Last labels");
8
staggerBackground = staggerLabels.background();
9
staggerBackground.stroke("#CCCCCC");
10
11
// enabling stagger mode
12
staggerxAxis = staggerLabels.xAxis();
13
staggerxAxis.staggerMode(true);
14
// adjusting settings for stagger mode
15
staggerxAxis.staggerLines(2);
16
17
// set scale minimum
18
staggerYScale = staggerLabels.yScale();
19
staggerYScale.minimum(0);
20
21
// data set for stagger mode sample
22
staggerData = anychart.data.set([
23
["Category1", 16, 20],
24
["Category2", 12, 18],
25
["Category3", 9, 14],
26
["Category4", 13, 15],
27
["Category5", 19, 16],
28
["Category6", 14, 10],
29
["Category7", 11, 22],
30
["Category8", 17, 11],
31
["Category9", 9, 14]
32
]);
33
34
// data remapping for stagger sample
35
staggerSeriesData_1 = staggerData.mapAs({x: [0], value: [1]});
36
staggerSeriesData_2 = staggerData.mapAs({x: [0], value: [2]});
37
38
staggerLabels.column(staggerSeriesData_1);
39
staggerLabels.column(staggerSeriesData_2);
40
41
// disabling first and last labels
42
staggerAxis = staggerLabels.xAxis();
43
staggerAxis.drawFirstLabel(false);
44
staggerAxis.drawLastLabel(false);
45
46
staggerLabels.container(stage);
47
staggerLabels.draw();
48
});