简体   繁体   中英

How to change Marker/Pin color on google Map Chart

i want to change the Colors for Markers/Pins on Google Map Chart, this is how i am doing it. I am unable to display any marker, with customize image/color.

<script>
        google.load("visualization", "1", {packages:["map"]});
        google.setOnLoadCallback(drawMap);
        function drawMap(dataArray) {
            var pinColor = "FE7569";
            var pinImage = new google.maps.MarkerImage("http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=%E2%80%A2|" + pinColor,
            new google.maps.Size(21, 34),
            new google.maps.Point(0,0),
            new google.maps.Point(10, 34));
            var pinShadow = new google.maps.MarkerImage("http://chart.apis.google.com/chart?chst=d_map_pin_shadow",
            new google.maps.Size(40, 37),
            new google.maps.Point(0, 0),
            new google.maps.Point(12, 35));
            var data = google.visualization.arrayToDataTable(dataArray);
            var map = new google.visualization.Map(document.getElementById('map_div'));
            map.Marker({
                position: new google.maps.LatLng(0,0), 
                map: map,
                icon: pinImage,
                shadow: pinShadow
            });
            var options = {mapType: 'terrain',showTip: true,useMapTypeControl:true};

            map.draw(data,options);
        }
    </script>

iconFileErr = ' http://maps.google.com/mapfiles/ms/icons/red-dot.png '; marker.setIcon(iconFileErr);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM