首页 > 解决方案 > Amchart:改变 MapChart 错误的颜色

问题描述

我有一个没有颜色的世界地图图表(国家默认为灰色,海洋默认为白色):

在此处输入图像描述

我的代码:

var container = am4core.create("concatChart", am4core.Container);
container.width = am4core.percent(100);
container.height = am4core.percent(100);

this.mapChart = container.createChild(am4maps.MapChart);
this.mapChart.geodata = am4geodata_continentsHigh;
this.mapChart.projection = new am4maps.projections.Miller();

var polygonSeries = this.mapChart.series.push(new am4maps.MapPolygonSeries());
polygonSeries.useGeodata = true;

我通过将这些行添加到我的代码中添加了一些颜色:

this.mapChart.backgroundSeries.mapPolygons.template.polygon.fill = am4core.color("#91c2dc");
this.mapChart.backgroundSeries.mapPolygons.template.polygon.fillOpacity = 1;

polygonSeries.mapPolygons.template.fill = am4core.color("#FFFFFF");
polygonSeries.mapPolygons.template.strokeOpacity = 0;

但它实际上被窃听了,似乎世界地图被切割了:

在此处输入图像描述

标签: dictionarycolorsamcharts

解决方案



推荐阅读