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
var stage = anychart.graphics.create('container');
3
4
var chart1 = anychart.column();
5
chart1.bounds(0, 0, '100%', '50%');
6
7
var series1 = chart1.line([
8
{x: 'January', value: 2},
9
{x: 'February', value: 5},
10
{x: 'March', value: 3},
11
{x: 'April', value: 9},
12
{x: 'May', value: 4}
13
]);
14
15
var labels1 = series1.labels();
16
labels1.enabled(true);
17
labels1.height('5%');
18
labels1.width('5%');
19
labels1.background({fill: '#FFFFFF'});
20
labels1.format(function () {
21
return 'Value: ' + this.value + '\n' + 'Index: ' + this.index
22
});
23
labels1.adjustFontSize(true, true);
24
25
chart1.container(stage);
26
chart1.draw();
27
28
var chart2 = anychart.line();
29
chart2.bounds(0, '50%', '100%', '50%');
30
31
var series2 = chart2.line([
32
{x: 'January', value: 2},
33
{x: 'February', value: 5},
34
{x: 'March', value: 3},
35
{x: 'April', value: 9},
36
{x: 'May', value: 4}
37
]);
38
39
var labels2 = series2.labels();
40
labels2.enabled(true);
41
labels2.height('5%');
42
labels2.width('5%');
43
labels2.background({fill: '#FFFFFF'});
44
labels2.format(function () {
45
return 'Value: ' + this.value + '\n' + 'Index: ' + this.index
46
});
47
48
// Get adjust font size.
49
var adjustFontSize = labels1.adjustFontSize();
50
labels2.adjustFontSize(adjustFontSize);
51
chart2.container(stage);
52
chart2.draw();
53
54
var title = anychart.standalones.title();
55
title.text('Get and modify adjust font size');
56
title.container(stage);
57
title.draw();
58
});