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
// setting data
4
var data = anychart.data.set([
5
["C", 15],
6
["D", -25],
7
["E", 25]
8
]);
9
10
var stage = anychart.graphics.create("container");
11
12
// setting basic title
13
var mainTitle = anychart.standalones.title();
14
mainTitle.parentBounds(0, 0, stage.width(), stage.height()*0.1);
15
mainTitle.text("Minimum/Maximum Gap Samples");
16
mainTitle.container(stage);
17
mainTitle.draw();
18
19
// first chart
20
var valueStackedMode = anychart.column();
21
22
// set chart title
23
valueStackedMode.title("Gap Sample");
24
25
// setting chart's size and position
26
valueStackedMode.bounds(0, "15%", "50%", "85%");
27
28
var valueBackgorund = valueStackedMode.background();
29
valueBackgorund.stroke("#CCCCCC");
30
31
// disable axes title
32
var valueXAxis = valueStackedMode.xAxis();
33
valueXAxis.title(false);
34
var valueYAxis = valueStackedMode.yAxis();
35
valueYAxis.title(false);
36
37
// setting gaps
38
var valueYMinorTicks = valueStackedMode.yScale().minorTicks();
39
valueYMinorTicks.interval(2);
40
var valueYTicks = valueStackedMode.yScale().ticks();
41
valueYTicks.interval(10);
42
43
var valueYScale = valueStackedMode.yScale();
44
valueYScale.minimumGap(0.5);
45
valueYScale.maximumGap(0.5);
46
47
valueStackedMode.column(data);
48
49
valueStackedMode.container(stage);
50
valueStackedMode.draw();
51
52
53
var percentStackedMode = anychart.column();
54
55
percentStackedMode.title("Sample without Gap");
56
57
// setting chart's size and position
58
percentStackedMode.bounds("50%", "15%", "50%", "85%");
59
60
var paecentBackground = percentStackedMode.background();
61
paecentBackground.stroke("#CCCCCC");
62
63
// disable Axes titles
64
var percentYAxis = percentStackedMode.yAxis();
65
percentYAxis.title(false);
66
var percentXAxis = percentStackedMode.xAxis();
67
percentXAxis.title(false);
68
69
// setting ticks
70
var percentYTicks = percentStackedMode.yScale().ticks();
71
percentYTicks.interval(10);
72
var percentYMinorTicks = percentStackedMode.yScale().minorTicks();
73
percentYMinorTicks.interval(2);
74
75
percentStackedMode.column(data);
76
77
percentStackedMode.container(stage);
78
percentStackedMode.draw();
79
});