Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

VEMap.ShowTrafficLegend Method

You are not viewing the latest version of the AJAX control. Bing Maps AJAX V7 is the recommended JavaScript control for Bing Maps. If you need this documentation, it is available in as a CHM or PDF download.

Displays the traffic legend.

VEMap.ShowTrafficLegend(x, y)


Parameter Description


The x-coordinate of the top-left corner of the legend. Optional.


The y-coordinate of the top-left corner of the legend. Optional.

If x and y are not specified, the legend is displayed at the bottom-right of the copyright. If the legend is already visible, this method moves the legend to the specified coordinates, or to the bottom-right if x and y are not specified.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

      <script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.3"></script>

      <script type="text/javascript">
         var map = null;
         var Location = new VELatLong(47.64, -122.23);

         function GetMap()
            map = new VEMap('myMap');
            map.LoadMap(Location, 9);

         function ShowTraffic()
            map.SetTrafficLegendText("The traffic legend");

         function ClearTraffic()
   <body onload="GetMap();" style="font-family:Arial">
      <div id='myMap' style="position:relative; width:600px; height:400px;"></div>
      <input id="showtraffic"  type="button" value="Show Traffic"  onclick="ShowTraffic();"/>
      <input id="cleartraffic" type="button" value="Clear Traffic" onclick="ClearTraffic();"/>

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft. All rights reserved.