amcharts - AmCharts4 删除地图图表中的大陆
问题描述
我@amcharts/amcharts4-geodata/worldLow"
用来创建一个简单的地图,但不需要南极洲。有没有办法隐藏或删除它,但地图利用南极洲留下的空间来使地图相应地调整并使其他大陆更加突出?
初始化代码:
import * as am4maps from "@amcharts/amcharts4/maps";
import am4geodata_worldLow from "@amcharts/amcharts4-geodata/worldLow";
import am4themes_animated from "@amcharts/amcharts4/themes/animated";
let chart = am4core.create("globediv", am4maps.MapChart);
try {
chart.geodata = am4geodata_worldLow;
} catch (e) {
chart.raiseCriticalError(new Error("Map geodata could not be loaded."));
}
chart.projection = new am4maps.projections.Projection;
chart.panBehavior = "move";
let polygonSeries = chart.series.push(new am4maps.MapPolygonSeries());
polygonSeries.data = myData;
polygonSeries.useGeodata = true;
解决方案
使用此处exclude
记录的 polygonSeries 中的属性
polygonSeries.exclude = ["AQ"];
let chart = am4core.create("chartdiv", am4maps.MapChart);
try {
chart.geodata = am4geodata_worldLow;
} catch (e) {
chart.raiseCriticalError(new Error("Map geodata could not be loaded."));
}
chart.projection = new am4maps.projections.Miller();
chart.panBehavior = "move";
let polygonSeries = chart.series.push(new am4maps.MapPolygonSeries());
polygonSeries.useGeodata = true;
polygonSeries.exclude = ["AQ"];
#chartdiv {
width: 100%;
height: 400px;
}
<script src="https://cdn.amcharts.com/lib/4/core.js"></script>
<script src="https://cdn.amcharts.com/lib/4/maps.js"></script>
<script src="https://cdn.amcharts.com/lib/4/geodata/worldLow.js"></script>
<div id="chartdiv"></div>
推荐阅读
- linux - Linux中根据特定列值修改多列值
- c++ - 将部分字节有效推送到 std::queue
- r - 验证数据和去除噪音行的逻辑
- c# - Asp.Net Core:为集成测试重置 memoryCache
- .net-core - 带有 CosmosDB 的 EF Core:OwnsOne 和 OwnsMany 抛出 NullReferenceException
- node.js - 如何读取镶木地板文件 - parquetjs-lite
- css - 从 React-bootstrap 在日历上设置最大日期
- javascript - 代码在控制台中工作但不在扩展脚本中工作
- sql - Netezza - 用另一张表中的最大数据更新一张表
- python - 带有sympy极限的数值评估