Export (0) Print
Expand All

PolylineOptions Object

Bing

Represents the options for a polyline.

Properties

Name Type Description

strokeColor

Color

The color of the polyline.

strokeDashArray

string

A string representing the stroke/gap sequence to use to draw the polyline. The string must be in the format S, G, S*, G*, where S represents the stroke length and G represents gap length. Stroke lengths and gap lengths can be separated by commas or spaces. For example, a stroke dash string of “1 4 2 1” would draw the polyline with a dash, four spaces, two dashes, one space, and then repeated.

strokeThickness

number

The thickness of the polyline.

visible

boolean

A boolean indicating whether to show or hide the polyline. A value of false indicates that the polyline is hidden, although it is still an entity on the map.

Example

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
   <head>
      <title></title>
      <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=7.0"></script>

      <script type="text/javascript">

          var map = null;


         function GetMap()
         {
            // Initialize the map
            map = new Microsoft.Maps.Map(document.getElementById("mapDiv"),{credentials:"Your Bing Maps Key"}); 

            // Create the locations
            var location1 = new Microsoft.Maps.Location(-20,-20);
            var location2 = new Microsoft.Maps.Location(20,-20);
            var location3 = new Microsoft.Maps.Location(20,20);
            var location4 = new Microsoft.Maps.Location(60, 20);
            var location5 = new Microsoft.Maps.Location(60, 60);


            // Create a polyline
            var lineVertices = new Array(location1, location2, location3, location4, location5);
            var line = new Microsoft.Maps.Polyline(lineVertices,{strokeColor:new Microsoft.Maps.Color(200, 100, 0, 100), strokeThickness:5, strokeDashArray:"5 2"});

            // Add the polyline to the map
            map.entities.push(line);

         }


      </script>
   </head>
   <body onload="GetMap();">
      <div id='mapDiv' style="position:relative; width:400px; height:400px;"></div>
   </body>
</html>
Show:
© 2015 Microsoft