1

I have implemented map with amcharts. When I select(zoom) a particular country, filling it will color. Now when I want to reset the map size, not able to remove the fill color.

This is my code

this.polygonSeries.dataFields.zoomLevel = "zoomLevel";
this.polygonSeries.dataFields.zoomGeoPoint = "zoomGeoPoint";
var polygonTemplate = this.polygonSeries.mapPolygons.template;
var as = polygonTemplate.states.create("active");
as.properties.fill = am4core.color("#d8854f");

Code to zoomout map

public mapCountry_selected(country)
{
  var target=this.polygonSeries.getPolygonById(country.id);
  // Pre-zoom
  this.mapChart .zoomToMapObject(target);
    setTimeout(function() {
      target.isActive = true;
}, 1000);
}

Code to Reset map. This code is only setting map to normal position but not removing the selected color from mapCountry_selected

public ResetButton()
{
var polygonTemplate = this.polygonSeries.mapPolygons.template;
var as = polygonTemplate.states.create("active");
as.properties.fill = am4core.color("#d9d9d9"); //default color
this.mapChart.goHome()
}

How can I remove fill color to normal?

1 Answer 1

1

set current active status in to default using setState("default") then it works. i added codepen below when you clicked home button view will set in to default state.

codepen for reset default

you can refer this one also amcharts states

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.