Amchart:更改MapChart错误的颜色

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Amchart:更改MapChart错误的颜色相关的知识,希望对你有一定的参考价值。

我有一个世界地图,没有颜色(默认情况下,国家/地区为灰色,海洋为白色):

enter image description here

我的代码:

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;

但是实际上是错误的,好像世界地图被切掉了:

enter image description here

答案

https://stackblitz.com/edit/am-charts-emkfjj?file=src/app/app.component.ts

我在代码中添加了更多信息。

以上是关于Amchart:更改MapChart错误的颜色的主要内容,如果未能解决你的问题,请参考以下文章

Amchart json url饼图不会发生

无法在 amchart5 中将标签从百分比更改为数字

如何使用数据库连接制作动态 amchart?

小程序map切换不同的标记点

Highcharts地图不改变悬停颜色

出现错误时如何在颤动中更改背景颜色文本框?