am5.addLicense("AM5C332591365"); am5.addLicense("AM5M386491625"); // Create root and chart var root = am5.Root.new("chartdiv"); // Set themes root.setThemes([ am5themes_Animated.new(root) ]); // Create the map chart // https://www.amcharts.com/docs/v5/charts/map-chart/ var chart = root.container.children.push(am5map.MapChart.new(root, { panX: "rotateX", panY: "rotateY", projection: am5map.geoOrthographic(), paddingBottom: 20, paddingTop: 20, paddingLeft: 20, paddingRight: 20 })); // Create series for background fill // https://www.amcharts.com/docs/v5/charts/map-chart/map-polygon-series/#Background_polygon var backgroundSeries = chart.series.push(am5map.MapPolygonSeries.new(root, {})); backgroundSeries.mapPolygons.template.setAll({ fill: am5.color(0x395b74), fillOpacity: 1, strokeOpacity: 0, stroke: am5.color(0x395b74) }); backgroundSeries.mapPolygons.template.setAll({ fill: am5.color(0x395b74), stroke: am5.color(0x395b74), }); backgroundSeries.data.push({ geometry: am5map.getGeoRectangle(90, 180, -90, -180), }); // Create polygon series var polygonSeries = chart.series.push( am5map.MapPolygonSeries.new(root, { geoJSON: am5geodata_worldLow, exclude: ["AQ"] }) ); polygonSeries.mapPolygons.template.setAll({ tooltipText: "{name}", templateField: "polygonSettings", fill: am5.color(0xc3c3c3) }); polygonSeries.mapPolygons.template.states.create("hover", { fill: am5.color(0x187e6a) }); polygonSeries.data.setAll([ {id: "BW","name": "Botswana", polygonSettings: { fill: am5.color(0x187e6a) } },{id: "CN","name": "China", polygonSettings: { fill: am5.color(0x187e6a) } },{id: "DO","name": "Dominican Republic", polygonSettings: { fill: am5.color(0x187e6a) } },{id: "EC","name": "Ecuador", polygonSettings: { fill: am5.color(0x187e6a) } },{id: "EG","name": "Egypt", polygonSettings: { fill: am5.color(0x187e6a) } },{id: "SZ","name": "Eswatini", polygonSettings: { fill: am5.color(0x187e6a) } },{id: "GH","name": "Ghana", polygonSettings: { fill: am5.color(0x187e6a) } },{id: "GD","name": "Grenada", polygonSettings: { fill: am5.color(0x187e6a) } },{id: "MW","name": "Malawi", polygonSettings: { fill: am5.color(0x187e6a) } },{id: "MX","name": "Mexico", polygonSettings: { fill: am5.color(0x187e6a) } },{id: "NA","name": "Namibia", polygonSettings: { fill: am5.color(0x187e6a) } },{id: "NG","name": "Nigeria", polygonSettings: { fill: am5.color(0x187e6a) } },{id: "PG","name": "Papua New Guinea", polygonSettings: { fill: am5.color(0x187e6a) } },{id: "SN","name": "Senegal", polygonSettings: { fill: am5.color(0x187e6a) } },{id: "SL","name": "Sierra Leone", polygonSettings: { fill: am5.color(0x187e6a) } },{id: "ZA","name": "South Africa", polygonSettings: { fill: am5.color(0x187e6a) } },{id: "SS","name": "South Sudan", polygonSettings: { fill: am5.color(0x187e6a) } },{id: "GM","name": "The Gambia", polygonSettings: { fill: am5.color(0x187e6a) } },{id: "TG","name": "Togo", polygonSettings: { fill: am5.color(0x187e6a) } },{id: "TN","name": "Tunisia", polygonSettings: { fill: am5.color(0x187e6a) } },{id: "ZW","name": "Zimbabwe", polygonSettings: { fill: am5.color(0x187e6a) } } ]) // Rotate animation chart.animate({ key: "rotationX", from: 0, to: 360, duration: 30000, loops: Infinity });