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
// This sample uses 3rd party proj4 component
4
// that makes it possible to set coordinates
5
// for the points and labels on the map and
6
// required for custom projections and grid labels formatting.
7
// See https://docs.anychart.com/7.14.3/Maps/Map_Projections
8
9
// create data set
10
var data = anychart.data.set([
11
{points: [51.5, -3.2, 57.1, -2.19], from: "Cardiff", to: "Aberdeen", time: "2h 20m"},
12
{points: [55.9, -3.2, 51.45, 0], from: "Edinburgh", to: "London", time: "1h 15m"},
13
{points: [54.7, -5.9, 57.6,-3.9], from: "Dublin", to: "Iverness", time: "2h 35m"}
14
]);
15
// create map chart
16
var map = anychart.map()
17
18
//create connector series
19
var series = map.connector(data);
20
21
// changing the curvature of the series
22
series.curvature(0.3);
23
24
// changing the startSize and endSize of the connectors
25
series.startSize(10);
26
series.endSize(0);
27
28
// set geodata
29
map.geoData(anychart.maps['united_kingdom']);
30
31
// setting colors for hovered and selected
32
series.fill("#FF9966");
33
series.stroke("#CCCC99");
34
series.hoverFill("#996633");
35
series.selectFill("#996633");
36
series.hoverStroke("#CCCC99");
37
series.selectStroke("#CCCC99");
38
39
// name of the chart
40
map.title("Settings the markers");
41
42
series.tooltip().format("A flight from {%from} to {%to} takes at least {%time}");
43
44
// setting the marker position
45
var markers = series.markers();
46
markers.position("end");
47
// setting the marker type
48
markers.type(anychart.enums.MarkerType.ARROWHEAD);
49
markers.size(15);
50
51
// setting the anchor
52
markers.anchor("leftCenter");
53
54
// set container id for the chart
55
map.container('container');
56
57
// initiate chart drawing
58
map.draw();
59
});