bing-mapspushpin

Text not showing up in custom pushpins? Is there a way?


This is the code I am using to plot my custom pushpins on Bing Maps. I can't get the text to print on the pushpin icon which is just the default pushpin but in a different color.

Is it even possible like this? Is there another way? I can't seem to find any, Help!

var pushpinOptions = {icon: '/assets/greenpin.png', visible: true};
var pushpin = new Microsoft.Maps.Pushpin(new Microsoft.Maps.Location(lat, lng), pushpinOptions, {text: alphas[i] });

Solution

  • Got It! Just had to add htmlContent to pushpinOptions

    var pushpinOptions = {icon: '/assets/greenpin.png', 
        visible: true, 
        htmlContent: '<div style="position: absolute; text-align: center; width: 100%; font-family: Arial, Helvetica, sans-serif; font-size: 10pt; font-style: normal; font-variant: normal; font-weight: bold; line-height: normal; color: rgb(255, 255, 255); left: 0px; top: 5px; ">'+alphas[i]+'</div>'
    };