This demo shows how you can add new images/markers to the map dynamically, without re-validating the whole map data.
The idea is to dynamically create a new MapImage
object, push it into images
array of maps dataProvider
, then call its validate()
method. I.e.:
var city = new AmCharts.MapImage(); city.title = "Vienna; city.latitude = 48.2092; city.longitude = 16.3728; city.type = "circle"; city.chart = map; map.dataProvider.images.push(city); city.validate();
You can set any property available in MapImage
.
Please note that setting chart
property with the reference to your map object is required for it to work properly.