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
32
1
anychart.onDocumentReady(function () {
2
var stage = anychart.graphics.create("container");
3
var columnChart = anychart.column();
4
columnChart.bounds(0, 0, "100%", "50%");
5
var series = columnChart.line([12, 25, 18, 29]);
6
var labels = series.labels();
7
labels.enabled(true);
8
labels.height("5%");
9
labels.width("5%");
10
labels.background({fill: "#FFFFFF"});
11
labels.format(function () {
12
return "Value: " + this.value + "\n" + "Index: " + this.index
13
});
14
labels.adjustFontSize(true, true);
15
columnChart.container(stage);
16
columnChart.draw();
17
var lineChart = anychart.line();
18
lineChart.bounds(0, "50%", "100%", "50%");
19
var lineSeries = lineChart.line([12, 25, 18, 29]);
20
var lineLabels = lineSeries.labels();
21
lineLabels.enabled(true);
22
lineLabels.height("5%");
23
lineLabels.width("5%");
24
lineLabels.background({fill: "#FFFFFF"});
25
lineLabels.format(function () {
26
return "Value: " + this.value + "\n" + "Index: " + this.index
27
});
28
var adjustFontSize = labels.adjustFontSize(); // get adjust font size
29
lineLabels.adjustFontSize(adjustFontSize);
30
lineChart.container(stage);
31
lineChart.draw();
32
});