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
// data
4
var data = [
5
{x:1, value:990, state: "selected", selected: {fill:"Green"}},
6
{x:2, value:1100, state: "selected", selected: {fill:"Blue"}},
7
{x:3, value:1050, selected: {fill:"Red"}},
8
{x:4, value:890, selected: {fill:"Red"}},
9
{x:5, value:1300, state: "selected", selected: {fill:"Red"}},
10
{x:6, value:840, state: "selected", selected: {fill:"Green"}},
11
{x:7, value:900, selected: {fill:"Red"}},
12
{x:8, value:1000, selected: {fill:"Red"}}
13
];
14
15
// chart type
16
var chart = anychart.cartesian();
17
18
// set data
19
var series = chart.marker(data);
20
series.name("Price");
21
series.xPointPosition(0.5);
22
series.size(15);
23
series.hovered().size(25);
24
series.selected().size(15);
25
26
series.fill("#E0F08F");
27
series.stroke("none");
28
29
// chart title
30
chart.title("Interactivity through the dataSet with objects");
31
32
// set axes titles
33
chart.xAxis().title("Retail Channel");
34
chart.yAxis().title("Sales");
35
36
// enable legend
37
chart.legend(true);
38
39
// switching the select mode to multi
40
var interactivity = chart.interactivity();
41
interactivity.selectionMode("multi-select");
42
43
// draw
44
chart.container("container");
45
chart.draw();
46
});