-
Notifications
You must be signed in to change notification settings - Fork 0
/
globe_animate.js
65 lines (52 loc) · 2.05 KB
/
globe_animate.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/**
* ---------------------------------------
* This demo was created using amCharts 4.
*
* For more information visit:
* https://www.amcharts.com/
*
* Documentation is available at:
* https://www.amcharts.com/docs/v4/
* ---------------------------------------
*/
// Themes begin
am4core.useTheme(am4themes_animated);
// Themes end
var chart = am4core.create("chartdiv", am4maps.MapChart);
// Set map definition
chart.geodata = am4geodata_worldLow;
// Set projection
chart.projection = new am4maps.projections.Orthographic();
chart.panBehavior = "rotateLongLat";
chart.deltaLatitude = -20;
chart.padding(20,20,20,20);
// Create map polygon series
var polygonSeries = chart.series.push(new am4maps.MapPolygonSeries());
// Make map load polygon (like country names) data from GeoJSON
polygonSeries.useGeodata = true;
//polygonSeries.include = ["BR", "UA", "MX", "CI"];
// Configure series
var polygonTemplate = polygonSeries.mapPolygons.template;
polygonTemplate.tooltipText = "{name}";
polygonTemplate.fill = am4core.color("#FF6633");
polygonTemplate.stroke = am4core.color("#000033");
polygonTemplate.strokeWidth = 0.5;
polygonTemplate.cursorOverStyle = am4core.MouseCursorStyle.pointer;
polygonTemplate.url = "https://www.datadrum.com/main.php?package={id}";
polygonTemplate.urlTarget = "_blank";
var graticuleSeries = chart.series.push(new am4maps.GraticuleSeries());
//graticuleSeries.mapLines.template.line.stroke = am4core.color("#ffffff");
graticuleSeries.mapLines.template.line.strokeOpacity = 0.08;
graticuleSeries.fitExtent = false;
chart.backgroundSeries.mapPolygons.template.polygon.fillOpacity = 0.8;
chart.backgroundSeries.mapPolygons.template.polygon.fill = am4core.color("#000000");
// Create hover state and set alternative fill color
//var hs = polygonTemplate.states.create("hover");
//hs.properties.fill = chart.colors.getIndex(0).brighten(-0.5);
let animation;
setTimeout(function(){
animation = chart.animate({property:"deltaLongitude", to:100000}, 2500000);
}, 3000)
chart.seriesContainer.events.on("down", function(){
// animation.stop();
})