HTMLcopy
1
<label><input onclick="switchType('circle')" type="radio" name="type" checked>Circle</label>
2
<label><input onclick="switchType('flag')" type="radio" name="type">Flag</label>
3
<label><input onclick="switchType('pin')" type="radio" name="type">Pin</label>
4
<label><input onclick="switchType('rect')" type="radio" name="type">Rectangle</label>
5
<div id="container"></div>
CSScopy
16
1
html, body {
2
width: 100%;
3
height: 100%;
4
margin: 0;
5
padding: 0;
6
}
7
label {
8
display: inline-block;
9
margin: 10px 0 0 10px;
10
}
11
#container {
12
position: absolute;
13
width: 100%;
14
top: 35px;
15
bottom: 0;
16
}
JavaScriptcopy
x
1
anychart.onDocumentReady(function () {
2
3
// the data used in this sample can be obtained from the CDN
4
// https://cdn.anychart.com/csv-data/csco-daily.js
5
// create a data table using this data
6
var dataTable = anychart.data.table();
7
dataTable.addData(get_csco_daily_short_data());
8
9
// map the data
10
var mapping = dataTable.mapAs({value: 4});
11
12
// create a stock chart
13
var chart = anychart.stock();
14
15
// create a plot on the chart
16
var plot = chart.plot(0);
17
18
// create a line series
19
plot.line(mapping).name("CSCO");
20
21
eventMarkers = plot.eventMarkers();
22
23
// add event markers
24
plot.eventMarkers({"groups": [
25
{
26
"data": [
27
{
28
"date": "2006-06-08",
29
"description": "Cisco announced the acquisition of Audium Corporation."
30
},
31
{
32
"date": "2008-04-27",
33
"description": "Cisco announced its intent to acquire PostPath, Inc."
34
}
35
]
36
}
37
]});
38
39
// set the chart title
40
chart.title("Event Markers: Type");
41
42
// set the container id
43
chart.container("container");
44
45
// initiate drawing the chart
46
chart.draw();
47
});
48
49
// switch the type of event markers
50
function switchType(type){
51
eventMarkers.type(type);
52
}