Forum Discussion

Blaenzo's avatar
Blaenzo
Icon for Advocate II rankAdvocate II
7 years ago
Solved

Filter report based on Google Maps marker click event

I have Google Maps fully working in a custom visual except for the filtering of the rest of the report when I select a marker in the map.   My question is; how can I store the identity: powerbi.vi...
  • Blaenzo's avatar
    7 years ago

    I solved it the easy way by creating the click event on creation of the marker:

     

    var markers = this.viewModel.dataPoints.map(function (dp, i) {
    
    	var marker = new google.maps.Marker({
    		position: new google.maps.LatLng(
    			dp.lat,
    			dp.lng
    		),
    		title: dp.category,
    		zIndex: i
    	})
    
    	google.maps.event.addListener(marker, 'click', (function (marker) {
    		return function () {
    			thisRef.selectionManager.select(dp.identity)
    		}
    	})(marker));
    
    	return marker;
    })