user2030592
user2030592

Reputation: 417

Selecting MapPoint via ID

how can I activate a point on the map using the ID of a point?

I thought of something like "series.select(1234)" -> https://api.anychart.com/7.12.0/anychart.core.map.series.Marker#select

But for example this code doesn't select any point on my map:

var series = map.marker(data);
series.select(2359);

Any ideas?

Upvotes: 1

Views: 110

Answers (2)

blackart
blackart

Reputation: 86

If you want to select point by an id or other field you should find index of this point in the data. Use method "find" of data mapping.

var dataSet = anychart.data.set([
  {lat: -33.28, long: 135.58, id: 'myPoint'},
]);

var view = dataSet.mapAs();
var series = australiaMap.marker(view);

var index = view.find('id', 'myPoint');
series.select(index);

Example: http://jsfiddle.net/4sn65L52/3/

Upvotes: 2

AnyChart Support
AnyChart Support

Reputation: 3905

It looks like you've passed the wrong arguments to the select() method. In this case you should pass the array of indexes of the point to select, like

series.select([0, 1, 4]);

Also, you can take a look at this working example: http://jsfiddle.net/anycharts/4sn65L52/

Upvotes: 1

Related Questions