• kskbgs
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
Hi all
plz help me in creating a google map containing markers using lat/long fields of account.I was able to do by hard coding values but I want to generate dynamically.
see below code for ref.
<apex:page controller="TestExam">
<html>
  <head>
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
      google.load("visualization", "1", {packages:["map"]});
      google.setOnLoadCallback(drawChart);
      function drawChart() {
    
      var lat = [37.4232, 37.4289];
   
  var lon = [-122.0853, -122.1697];

  var data = new google.visualization.DataTable();
  data.addColumn('number', 'lat');
  data.addColumn('number', 'lon');

  for(i = 0; i < lat.length; i++)
    data.addRow([lat[i], lon[i]]);

     
        var map = new google.visualization.Map(document.getElementById('map_div'));
        map.draw(data, {showTip: true});
      }

    </script>
  </head>

  <body>
    <div id="map_div" style="width: 400px; height: 300px"></div>
  </body>
</html>
</apex:page>


I want to fetch lat,lon values from accounts dynamically

 
  • March 28, 2015
  • Like
  • 0