我正在尝试将fillColor应用于这样的折线。jquery - `fillColor`在Google map 中不起作用-LMLPHP

但是我做不到,这是怎么了?

poly = new google.maps.Polyline({
          strokeColor: '#00DB00',
          strokeOpacity: 1.0,
          strokeWeight: 3,
          fillColor: 'green',
          fillOpacity: 0.05
        });
        poly.setMap(map);


小提琴:https://jsfiddle.net/vL6qpn4w/

Doubt:如何使用我的代码绘制多边形?

最佳答案

折线不支持填充颜色,因为它们是简单的线。尝试改用具有填充和笔触属性的多边形-给出上面要尝试的内容。
https://developers.google.com/maps/documentation/javascript/shapes#polygons

poly = new google.maps.Polygon({
      strokeColor: '#00DB00',
      strokeOpacity: 1.0,
      strokeWeight: 3,
      fillColor: 'green',
      fillOpacity: 0.05 //Increase this to make the green background darker
    });
    poly.setMap(map);


新提琴:https://jsfiddle.net/c3znthny/1/

09-19 21:22