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.column([
6
{x: 0, value: 22},
7
{x: 1, value: 34},
8
{x: 2, value: 16},
9
]);
10
chart1.column([
11
{x: 0, value: 12},
12
{x: 1, value: 41},
13
{x: 2, value: 47}
14
]);
15
chart1.bounds(0, 10, '50%', '100%');
16
17
var interactivity1 = chart1.interactivity();
18
interactivity1.selectionMode('single-select');
19
20
chart1.container(stage);
21
chart1.draw();
22
23
var chart2 = anychart.bar();
24
chart2.bar([
25
{x: 0, value: 18},
26
{x: 1, value: 5},
27
{x: 2, value: 12}
28
]);
29
chart2.bar([
30
{x: 0, value: 10},
31
{x: 1, value: 25},
32
{x: 2, value: 16}
33
]);
34
chart2.bounds('50%', 10, '50%', '100%');
35
36
// Get selection mode of the column chart.
37
var selectionMode = interactivity1.selectionMode();
38
39
var interactivity2 = chart2.interactivity();
40
interactivity2.selectionMode(selectionMode);
41
42
chart2.container(stage);
43
chart2.draw();
44
45
var title = anychart.standalones.title();
46
title.text('Get and use selection mode');
47
title.container(stage);
48
title.draw();
49
});