Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
* @see {@link https://www.amcharts.com/docs/v4/chart-types/map/}
*/
import * as am4core from "@amcharts/amcharts4/core";
import * as am4maps from "@amcharts/amcharts4/maps";
import am4themes_animated from "@amcharts/amcharts4/themes/animated";
import am4geodata_worldLow from "@amcharts/amcharts4-geodata/worldLow";
import am4geodata_continentsLow from "@amcharts/amcharts4-geodata/continentsLow";
// Themes begin
am4core.useTheme(am4themes_animated);
// Themes end
// Create map instance
var chart = am4core.create("chartdiv", am4maps.MapChart);
// Set projection
chart.projection = new am4maps.projections.Mercator();
var restoreContinents = function() {
hideCountries();
chart.goHome();
};
// Zoom control
chart.zoomControl = new am4maps.ZoomControl();
var homeButton = new am4core.Button();
homeButton.events.on("hit", restoreContinents);
homeButton.icon = new am4core.Sprite();
import * as am4core from "@amcharts/amcharts4/core";
import * as am4maps from "@amcharts/amcharts4/maps";
import am4themes_dark from "@amcharts/amcharts4/themes/dark";
import am4themes_animated from "@amcharts/amcharts4/themes/animated";
import am4geodata_continentsLow from "@amcharts/amcharts4-geodata/continentsLow";
am4core.useTheme(am4themes_animated);
var mapChart = am4core.create("chartdiv", am4maps.MapChart);
try {
mapChart.geodata = am4geodata_continentsLow;
}
catch (e) {
mapChart.raiseCriticalError(new Error("Map geodata could not be loaded. Please download the latest amcharts geodata and extract its contents into the same directory as your amCharts files."));
}
mapChart.projection = new am4maps.projections.Miller;
// prevent dragging
mapChart.seriesContainer.draggable = false;
mapChart.seriesContainer.resizable = false;
// prevent zooming
mapChart.minZoomLevel = 1;
// countries
var countriesSeries = mapChart.series.push(new am4maps.MapPolygonSeries());
// times of events
let startTime = new Date(2018, 0, 13, 6).getTime();
let endTime = new Date(2018, 0, 13, 11, 59).getTime();
let launchTime = new Date(2018, 0, 13, 7, 0).getTime();
let alertTime = new Date(2018, 0, 13, 8, 7).getTime();
let cancelTime = new Date(2018, 0, 13, 8, 45).getTime();
let colorSet = new am4core.ColorSet();
let currentTime: number;
let container = am4core.create("chartdiv", am4core.Container);
container.width = am4core.percent(100);
container.height = am4core.percent(100);
// map chart ////////////////////////////////////////////////////////
let mapChart = container.createChild(am4maps.MapChart);
try {
mapChart.geodata = am4geodata_continentsLow;
}
catch (e) {
mapChart.raiseCriticalError(new Error("Map geodata could not be loaded. Please download the latest <a href="\"https://www.amcharts.com/download/download-v4/\"">amcharts geodata</a> and extract its contents into the same directory as your amCharts files."));
}
mapChart.projection = new am4maps.projections.Miller();
mapChart.deltaLongitude = 145;
mapChart.seriesContainer.draggable = false;
let polygonSeries = mapChart.series.push(new am4maps.MapPolygonSeries());
polygonSeries.useGeodata = true;
polygonSeries.exclude = ["Antarctica"];
* This is a demo for MapChart.
*
* Refer to the following link(s) for reference:
* @see {@link https://www.amcharts.com/docs/v4/chart-types/map/}
*/
import * as am4core from "@amcharts/amcharts4/core";
import * as am4maps from "@amcharts/amcharts4/maps";
import am4themes_animated from "@amcharts/amcharts4/themes/animated";
import am4geodata_worldLow from "@amcharts/amcharts4-geodata/worldLow";
// Set themes
am4core.useTheme(am4themes_animated);
// Create the map chart
let chart = am4core.create("chartdiv", am4maps.MapChart);
// Chech if proper geodata is loaded
try {
chart.geodata = am4geodata_worldLow;
}
catch (e) {
chart.raiseCriticalError(new Error("Map geodata could not be loaded. Please download the latest <a href="\"https://www.amcharts.com/download/download-v4/\"">amcharts geodata</a> and extract its contents into the same directory as your amCharts files."));
}
// Set projection to be used
// @see {@link https://www.amcharts.com/docs/v4/reference/mapchart/#projection_property}
chart.projection = new am4maps.projections.Miller();
// Create polygon series
let polygonSeries = chart.series.push(new am4maps.MapPolygonSeries());
// times of events
let startTime = new Date(2018, 0, 13, 6).getTime();
let endTime = new Date(2018, 0, 13, 11, 59).getTime();
let launchTime = new Date(2018, 0, 13, 7, 0).getTime();
let alertTime = new Date(2018, 0, 13, 8, 7).getTime();
let cancelTime = new Date(2018, 0, 13, 8, 45).getTime();
let colorSet = new am4core.ColorSet();
let currentTime;
let container = am4core.create("chartdiv", am4core.Container);
container.width = am4core.percent(100);
container.height = am4core.percent(100);
// map chart ////////////////////////////////////////////////////////
let mapChart = container.createChild(am4maps.MapChart);
try {
mapChart.geodata = am4geodata_continentsLow;
}
catch (e) {
mapChart.raiseCriticalError(new Error("Map geodata could not be loaded. Please download the latest <a href="\"https://www.amcharts.com/download/download-v4/\"">amcharts geodata</a> and extract its contents into the same directory as your amCharts files."));
}
mapChart.projection = new am4maps.projections.Miller();
mapChart.deltaLongitude = 145;
mapChart.seriesContainer.draggable = false;
let polygonSeries = mapChart.series.push(new am4maps.MapPolygonSeries());
polygonSeries.useGeodata = true;
polygonSeries.exclude = ["Antarctica"];
* @see {@link https://www.amcharts.com/docs/v4/chart-types/map/}
*/
import * as am4core from "@amcharts/amcharts4/core";
import * as am4maps from "@amcharts/amcharts4/maps";
import am4themes_animated from "@amcharts/amcharts4/themes/animated";
import am4geodata_worldLow from "@amcharts/amcharts4-geodata/worldLow";
import am4geodata_continentsLow from "@amcharts/amcharts4-geodata/continentsLow";
// Themes begin
am4core.useTheme(am4themes_animated);
// Themes end
// Create map instance
var chart = am4core.create("chartdiv", am4maps.MapChart);
// Set projection
chart.projection = new am4maps.projections.Mercator();
var restoreContinents = function() {
hideCountries();
chart.goHome();
};
// Zoom control
chart.zoomControl = new am4maps.ZoomControl();
var homeButton = new am4core.Button();
homeButton.events.on("hit", restoreContinents);
homeButton.icon = new am4core.Sprite();
import * as am4core from "@amcharts/amcharts4/core";
import * as am4maps from "@amcharts/amcharts4/maps";
import am4themes_dark from "@amcharts/amcharts4/themes/dark";
import am4themes_animated from "@amcharts/amcharts4/themes/animated";
import am4geodata_continentsLow from "@amcharts/amcharts4-geodata/continentsLow";
am4core.useTheme(am4themes_animated);
var mapChart = am4core.create("chartdiv", am4maps.MapChart);
try {
mapChart.geodata = am4geodata_continentsLow;
}
catch (e) {
mapChart.raiseCriticalError(new Error("Map geodata could not be loaded. Please download the latest <a href="\"https://www.amcharts.com/download/download-v4/\"">amcharts geodata</a> and extract its contents into the same directory as your amCharts files."));
}
mapChart.projection = new am4maps.projections.Miller;
// prevent dragging
mapChart.seriesContainer.draggable = false;
mapChart.seriesContainer.resizable = false;
// prevent zooming
mapChart.minZoomLevel = 1;
// countries
var countriesSeries = mapChart.series.push(new am4maps.MapPolygonSeries());
*
* Refer to the following link(s) for reference:
* @see {@link https://www.amcharts.com/docs/v4/chart-types/map/}
*/
import * as am4core from "@amcharts/amcharts4/core";
import * as am4maps from "@amcharts/amcharts4/maps";
import am4themes_animated from "@amcharts/amcharts4/themes/animated";
import am4geodata_continentsLow from "@amcharts/amcharts4-geodata/continentsLow";
// Themes begin
am4core.useTheme(am4themes_animated);
// Themes end
// Create map instance
var chart = am4core.create("chartdiv", am4maps.MapChart);
var interfaceColors = new am4core.InterfaceColorSet();
// Set map definition
try {
chart.geodata = am4geodata_continentsLow;
}
catch (e) {
chart.raiseCriticalError(new Error("Map geodata could not be loaded. Please download the latest <a href="\"https://www.amcharts.com/download/download-v4/\"">amcharts geodata</a> and extract its contents into the same directory as your amCharts files."));
}
// Set projection
chart.projection = new am4maps.projections.Orthographic();
chart.panBehavior = "rotateLongLat";
chart.seriesContainer.cursorOverStyle = am4core.MouseCursorStyle.grab;
import * as am4core from "@amcharts/amcharts4/core";
import * as am4maps from "@amcharts/amcharts4/maps";
import am4themes_animated from "@amcharts/amcharts4/themes/animated";
import am4geodata_worldHigh from "@amcharts/amcharts4-geodata/worldHigh";
am4core.useTheme(am4themes_animated);
var countryCodes = ["AF", "AO", "AR", "AM", "AU", "AT", "AZ", "BD", "BY", "BE", "BO", "BA", "BW", "BR", "BG", "KH", "CM", "CA", "CF", "TD", "CL", "CN", "CO", "CG", "CD", "CR", "CI", "HR", "CU", "CY", "CZ", "DK", "EC", "EG", "ER", "EE", "ET", "FI", "FR", "GE", "DE", "GR", "GL", "GP", "GT", "GN", "GW", "GY", "HT", "HN", "HU", "IS", "IN", "ID", "IR", "IQ", "IE", "IL", "IT", "JM", "JP", "JO", "KZ", "KE", "KP", "KR", "KG", "LA", "LV", "LB", "LS", "LR", "LY", "LT", "LU", "MK", "MG", "MY", "ML", "MT", "MR", "MX", "MD", "MN", "ME", "MA", "MZ", "MM", "NA", "NP", "NL", "NZ", "NI", "NE", "NG", "NO", "OM", "PK", "PA", "PG", "PY", "PE", "PH", "PL", "PT", "RO", "RU", "SA", "SN", "RS", "SK", "SI", "SO", "ZA", "SS", "ES", "SD", "SE", "CH", "SY", "TW", "TJ", "TZ", "TH", "TN", "TR", "TM", "UA", "AE", "GB", "US", "UY", "UZ", "VE", "VN", "YE", "ZM", "ZW"];
var chart = am4core.create("chartdiv", am4maps.MapChart);
try {
chart.geodata = am4geodata_worldHigh;
}
catch (e) {
chart.raiseCriticalError(new Error("Map geodata could not be loaded. Please download the latest <a href="\"https://www.amcharts.com/download/download-v4/\"">amcharts geodata</a> and extract its contents into the same directory as your amCharts files."));
}
chart.projection = new am4maps.projections.Mercator();
chart.padding(0, 20, 0, 20);
chart.minZoomLevel = 0.9;
chart.zoomLevel = 0.9;
chart.maxZoomLevel = 1;
var polygonSeries = chart.series.push(new am4maps.MapPolygonSeries());
catch (e) {
chart.raiseCriticalError(new Error("Map geodata could not be loaded. Please download the latest <a href="\"https://www.amcharts.com/download/download-v4/\"">amcharts geodata</a> and extract its contents into the same directory as your amCharts files."));
}
chart.projection = new am4maps.projections.Mercator();
chart.padding(0, 20, 0, 20);
chart.minZoomLevel = 0.9;
chart.zoomLevel = 0.9;
chart.maxZoomLevel = 1;
var polygonSeries = chart.series.push(new am4maps.MapPolygonSeries());
polygonSeries.useGeodata = true;
polygonSeries.include = ["AF"];
var chart1 = am4core.create("hiddenchartdiv", am4maps.MapChart);
chart1.geodata = am4geodata_worldHigh;
chart1.projection = new am4maps.projections.Mercator();
var polygonSeries1 = chart1.series.push(new am4maps.MapPolygonSeries());
polygonSeries1.useGeodata = true;
polygonSeries1.include = ["AF"];
var label = chart.chartContainer.createChild(am4core.Label);
label.x = 100;
label.y = 100;
label.fill = am4core.color("#000000");
label.fontSize = 35;
label.fontWeight = "bold";
label.text = "Afghanistan";
label.fillOpacity = 0.2;