I am developing a web application in laravel and I must visualize a map with markers, circles, etc. I also use google charts and I have some tables. When I click on a table I select the marker whose position equals the position I have saved in the table (that's why google.visualiazation.Map is perfect for me to do that). The problem is that when drawing circles on the map I can not do it on google.visualization.Map, I can only on the api google.maps.Map. What exactly is the difference between the two?
This is my js code that I have in the view and it does not write me any circle:
var geo = {!! $geofences !!}
var dev = {!! $devices !!}
// Create our data table out of JSON data loaded from server.
var GeofencesTable = new google.visualization.DataTable();
GeofencesTable.addColumn('string', 'name');
GeofencesTable.addColumn('number', 'radius');
GeofencesTable.addColumn('string', 'latitude');
GeofencesTable.addColumn('string', 'longitude');
GeofencesTable.addColumn('string', 'emails');
GeofencesTable.addColumn('string', 'created_at');
GeofencesTable.addColumn('string', 'updated_at');
for (var i = 0; i < geo.length; i++) {
GeofencesTable.addRows([
[geo[i].name, geo[i].radius, geo[i].latitude, geo[i].longitude, geo[i].emails, geo[i].created_at, geo[i].updated_at]
]);
}
var tableGeo = new google.visualization.Table(document.getElementById('table_geo'));
tableGeo.draw(GeofencesTable, {showRowNumber: false});
// Create our data table out of JSON data loaded from server.
var DevicesTable = new google.visualization.DataTable();
DevicesTable.addColumn('string', 'name');
DevicesTable.addColumn('string', 'alias');
DevicesTable.addColumn('number', 'battery');
DevicesTable.addColumn('string', 'latitude');
DevicesTable.addColumn('string', 'longitude');
DevicesTable.addColumn('string', 'created_at');
DevicesTable.addColumn('string', 'updated_at');
var mapData = [['Lat', 'Lon', 'Description']];
for (var i = 0; i < dev.length; i++) {
DevicesTable.addRows([
[dev[i].name, dev[i].alias, dev[i].battery, dev[i].latitude, dev[i].longitude, dev[i].created_at, dev[i].updated_at]
]);
mapData.push([parseFloat(dev[i].latitude), parseFloat(dev[i].longitude), 'Battery: ' + dev[i].battery + ', Last movement: ' + dev[i].last_movement]);
}
var tableDev = new google.visualization.Table(document.getElementById('table_dev'));
tableDev.draw(DevicesTable, {showRowNumber: false});
var Info = google.visualization.arrayToDataTable(mapData);
var geoView = new google.visualization.DataView(Info);
var options = {
showTooltip: true,
showInfoWindow: true,
useMapTypeControl: true,
icons: {
default: {
normal: 'http://icons.iconarchive.com/icons/paomedia/small-n-flat/48/map-marker-icon.png',
selected: 'http://icons.iconarchive.com/icons/icons-land/vista-map-markers/48/Map-Marker-Marker-Outside-Azure-icon.png'
}
},
};
var map = new google.visualization.Map(document.getElementById('map_div'));
map.draw(geoView, options);
google.visualization.events.addListener(tableDev, 'select',
function() {
map.setSelection(tableDev.getSelection());
});
google.visualization.events.addListener(tableGeo, 'select',
function() {
var circle = new google.maps.Circle({
map: map,
center: new google.maps.LatLng(41, -1),
radius: 500000
});
});
google.visualization.events.addListener(map, 'select',
function() {
tableDev.setSelection(map.getSelection());
});
Why does not the circle draw me?
Thanks in advance