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 = anychart.data.set([
5
{x:1, value:990, selectFill:"Red"},
6
{x:2, value:1100, selected:true, selectFill:"Blue"},
7
{x:3, value:1050, selectFill:"Red"},
8
{x:4, value:890, selectFill:"Red"},
9
{x:5, value:1300, selected:true, selectFill:"Red"},
10
{x:6, value:840, selected:true, selectFill:"Green"},
11
{x:7, value:900, selectFill:"Red"},
12
{x:8, value:1000, selectFill:"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.hoverSize(25);
24
series.selectSize(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
var xAxis = chart.xAxis();
34
xAxis.title("Retail Channel");
35
var yAxis = chart.yAxis();
36
yAxis.title("Sales");
37
38
// enable legend
39
chart.legend(true);
40
41
// switching the select mode to multi
42
var interactivity = chart.interactivity();
43
interactivity.selectionMode("multiselect");
44
45
// draw
46
chart.container("container");
47
chart.draw();
48
});