How to program this button?

0

I am with this code and I can not program the [Source] button to the event that shows a bubble at the coordinate point. However, it marks the blue balloon instead of displaying the information. I know the statement is going to the right place but I am not able to program the correct object. I already tried to play the script right on the button and it did not work either.

                      DeMarchi Tracking                                              Origin

<script>
    var origem = document.getElementById("origem");
    origem.addEventListener('click', function(){
        addInfoBubble(map);
    })
</script>

'

function addMarkerToGroup(group, coordinate, html) {
  var marker = new H.map.Marker(coordinate);
  marker.setData(html);
  group.addObject(marker);
}
// Começa aqui a parte do bubble

function addInfoBubble(map) {
  var group = new H.map.Group();

  map.addObject(group);

  group.addEventListener('tap', function (evt) {

    var bubble =  new H.ui.InfoBubble(evt.target.getPosition(), {
      content: evt.target.getData()
    });
    ui.addBubble(bubble);
  }, false);

  addMarkerToGroup(group, {lat:-23.53244, lng:-46.73776},
    '<div>CodOrigem' +
    '</div><div>Ceagesp<br>MFE-B</div>');

}
//Termina aqui a parte do bubble.

var platform = new H.service.Platform({
  app_id: 'APP_ID',
  app_code: 'APP_CODE',
  useCIT: true,
  useHTTPS: true
});
var defaultLayers = platform.createDefaultLayers();

var map = new H.Map(document.getElementById('map'),
  defaultLayers.normal.map,{
  center: {lat:-23.53389, lng:-46.73617},
  zoom: 15
});

var behavior = new H.mapevents.Behavior(new H.mapevents.MapEvents(map));

var ui = H.ui.UI.createDefault(map, defaultLayers);

addInfoBubble(map);
<!DOCTYPE html>
<html>
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=yes">
    <meta http-equiv="Content-type" content="text/html;charset=UTF-8">
    <meta name="description" content="Open an infobubble when a marker is clicked">
    <title>Rastreamento DeMarchi</title>
    <link rel="stylesheet" type="text/css" href="https://js.api.here.com/v3/3.0/mapsjs-ui.css" />
    <script type="text/javascript" src="https://js.api.here.com/v3/3.0/mapsjs-core.js"></script><scripttype="text/javascript" src="https://js.api.here.com/v3/3.0/mapsjs-service.js"></script><scripttype="text/javascript" src="https://js.api.here.com/v3/3.0/mapsjs-ui.js"></script><scripttype="text/javascript" src="https://js.api.here.com/v3/3.0/mapsjs-mapevents.js"></script></head><body><divid="map" style="width: 600px; height: 400px; background: grey"></div>
    <script type="text/javascript" src='js/app.js'></script>
    <button id="origem">Origem</button>

    <script>
        var origem = document.getElementById("origem");
        origem.addEventListener('click', function(){
            addInfoBubble(map);
        })
    </script>

  </body>
</html>

'

    
asked by anonymous 22.10.2018 / 20:49

0 answers