orhanc
unread,Apr 30, 2012, 7:21:43 AM4/30/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to google-maps-utility-library-v3
I'm trying to make average speed of the markers. Each markers title is
the speed. Here is my function but the label on the group won't
change. What am i doing wrong?
var markerCluster = new MarkerClusterer(map, markers, mcOptions,
{ 'calculator': averageSpeed(markers) });
function averageSpeed(markers) {
var total = 0, counted = 0;
for (var i = 0; i < markers.length; i++) {
if (markers[i].title > 0) { // if markers speed is 0 skip
total += parseInt(markers[i].title);
counted++;
}
}
var value = Math.round(total * 10 / markers.length) / 10;
var index = parseInt(value / 30, 10) + 1;
return {
text: total / counted,
index: index
};
}