i am using fitbound function to autozooom on polyline of map. but on first
time it not works properly if i change the chartData and call same function
again it works fine. the function code is below.
var mapOptions = {
zoom: 1,
center: { lat: 0, lng: 0 },
zoomControl: true,
zoomControlOptions: {
style: google.maps.ZoomControlStyle.SMALL
},
mapTypeId: 'satellite'
};
this.chart = new
google.maps.Map(document.getElementById(chart_element.id), mapOptions);
let polylinePath = new google.maps.Polyline({
path: chart_data,
geodesic: true,
strokeColor: '#FF0000',
strokeOpacity: 1.0,
strokeWeight: 2
});
/* set auto zoom level to polyline */
var latlngbounds = new google.maps.LatLngBounds();
for (var i = 0; i < this.chartData.length; i++) {
latlngbounds.extend(this.chartData[i]);
}
this.chart.fitBounds(latlngbounds);
/* Set polyline chart to map */
polylinePath.setMap(this.chart);
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-visualization-api/f7d6d15b-fb86-4a2a-9af5-55ce321e6b9c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.