这个问题可能是由于AmChart 5的默认配置导致的。如果需要完整显示地球并聚焦家庭位置,可以尝试使用以下代码示例:
以下是完整的JavaScript代码示例:
am4core.ready(function() {
// Create chart instance
var chart = am4core.create("chartdiv", am4plugins_map["am4plugins_map.js"].MapChart);
// Set map definition
chart.geodata = am4geodata_worldLow;
// Set projection
chart.projection = new am4maps.projections.Orthographic();
chart.panBehavior = "rotateLongLat";
// Create map polygon series
var polygonSeries = chart.series.push(new am4maps.MapPolygonSeries());
polygonSeries.useGeodata = true;
polygonSeries.exclude = ["AQ"];
// Add home location marker
var home = polygonSeries.mapPolygons.create();
home.id = "home";
home.fill = am4core.color("#FFFFFF");
home.strokeWidth = 2;
home.stroke = am4core.color("#000000");
home.radius = 5;
home.latitude = /*[insert home location latitude]*/;
home.longitude = /*[insert home location longitude]*/;
// Add zoom control
chart.zoomControl = new am4maps.ZoomControl();
// Add home location focus button
var button = chart.createChild(am4core.Button);
button.label.text = "Focus Home";
button.align = "left";
button.events.on("hit", function() {
chart.goHome();
chart.zoomToGeoPoint({ latitude: home.latitude, longitude: home.longitude }, 4000, true);
chart.pan({ x: 0, y: 100 }, 2000);
});
});
请注意,上面的代码示例假定您已经包括了必要的AmChart和地理数据JavaScript文件,如下所示: