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], stroke:'navy', from: "Cardiff", to: "Aberdeen", marker: {fill: "#9fa8da"}, time: "2h 20m"},
12
{points: [55.9, -3.2, 51.45, 0], from: "Edinburgh", to: "London", time: "1h 15m"}
13
]);
14
// create map chart
15
var map = anychart.map()
16
17
//create connector series
18
var series = map.connector(data);
19
20
// changing the curvature of the series
21
series.curvature(0.3);
22
23
// changing the startSize and endSize of the connectors
24
series.startSize(10);
25
series.endSize(0);
26
27
// set geodata
28
map.geoData(anychart.maps['united_kingdom']);
29
30
//set markers
31
series.markers({position: '100%', size: 3, type: 'circle'});
32
series.hoverMarkers({position: '100%', size: 3, fill: '#1976d2', stroke: '2 #E1E1E1', type: 'circle'});
33
series.selectMarkers({position: '100%', size: 3, fill: '#1976d2', stroke: '2 #E1E1E1', type: 'circle'});
34
35
// name of the chart
36
map.title("Setting the size of the connectors in the start/end points");
37
38
series.tooltip().format("A flight from {%from} to {%to} takes at least {%time}");
39
40
// set container id for the chart
41
map.container('container');
42
43
// initiate chart drawing
44
map.draw();
45
});