<commit_before>var map;
function initMap() {
  // Create the map.
  map = new google.maps.Map(document.getElementById('map'), {
    zoom: 11,
    center: {lat: 41.8781, lng: -87.6298},
    mapTypeId: google.maps.MapTypeId.TERRAIN
  });
}

function checkForGraph(){
  if ( $( "#graph_stops" ).length || $( "#map" ).length){
    $('#graph_stops').remove();
    $('.display').append('<div id= "map"> </div>');
    initMap();
  }
}

function getBusStopData(url, color, item){
  $.ajax({
    type: "GET",
    contentType: "application/json; charset=utf-8",
    url: url,
    dataType: 'json',
    data: "{}", 
    async: true,
    success: function (data) {
      showData(data, map, '#FF0000');
    },
    error: function (result) {
      console.log("error");
       error();
    }
  });
}

function getBoardingData(url, color, type){
  $.ajax({
    type: "GET",
    contentType: "application/json; charset=utf-8",
    url: url,
    dataType: 'json',
    data: "{}", 
    async: true,
    success: function (data) {
      showData(data, map, color);
    },
    error: function (result) {
      console.log("error");
    }
  });
} 

  
function showData(data, map, color){
  for (var stop in data) {
  // Add the circle for this stop to the map.
    console.log("showData")
    var cityCircle = new google.maps.Circle({
      strokeColor: color,
      strokeOpacity: 0.8,
      strokeWeight: 2,
      fillColor: color,
      fillOpacity: 0.35,
      map: map,
      center: data[stop].center,
      radius: Math.sqrt(data[stop].boarding_number) * 20,
      radius: Math.sqrt(data[stop].buses) * 50
    });
  } 
}

$(document).on("click", "#show_bus_stops", function(){
  checkForGraph();
  $("#display").append('<div id="map_stops"><h2>Map of Bus Stops by Number of Stops Made</h2></div>');
  getBusStopData('riderships/data_stop_location_and_bus_count', 'red');
});

$(document).on("click", "#map_boarding_data", function(){
  checkForGraph();
  $("#display").append('<div id="map_stops"><h2>Map of Bus Stops by Average Number of People Boarding </h2></div>');
  getBoardingData('riderships/boarding_average_graph', 'blue');<commit_msg>update map to display smaller heatmap circles<commit_after>var map;
function initMap() {
  // Create the map.
  map = new google.maps.Map(document.getElementById('map'), {
    zoom: 11,
    center: {lat: 41.8781, lng: -87.6298},
    mapTypeId: google.maps.MapTypeId.TERRAIN
  });
}

function checkForGraph(){
  if ( $( "#graph_stops" ).length || $( "#map" ).length){
    $('#graph_stops').remove();
    $('.display').append('<div id= "map"> </div>');
    initMap();
  }
}

function getBusStopData(url, color, item){
  $.ajax({
    type: "GET",
    contentType: "application/json; charset=utf-8",
    url: url,
    dataType: 'json',
    data: "{}", 
    async: true,
    success: function (data) {
      showData(data, map, '#FF0000');
    },
    error: function (result) {
      console.log("error");
       error();
    }
  });
}

function getBoardingData(url, color, type){
  $.ajax({
    type: "GET",
    contentType: "application/json; charset=utf-8",
    url: url,
    dataType: 'json',
    data: "{}", 
    async: true,
    success: function (data) {
      showData(data, map, color);
    },
    error: function (result) {
      console.log("error");
    }
  });
} 

  
function showData(data, map, color){
  for (var stop in data) {
  // Add the circle for this stop to the map.
    console.log("showData")
    var cityCircle = new google.maps.Circle({
      strokeColor: color,
      strokeOpacity: 0.4,
      strokeWeight: 1,
      fillColor: color,
      fillOpacity: 0.25,
      map: map,
      center: data[stop].center,
      radius: Math.sqrt(data[stop].boarding_number) * 20,
      radius: Math.sqrt(data[stop].buses) * 20
    });
  } 
}

$(document).on("click", "#show_bus_stops", function(){
  checkForGraph();
  $("#display").append('<div id="map_stops"><h2>Map of Number of Buses Using Each Stop/h2></div>');
  getBusStopData('riderships/data_stop_location_and_bus_count', 'red');
});

$(document).on("click", "#map_boarding_data", function(){
  checkForGraph();
  $("#display").append('<div id="map_stops"><h2>Map of Bus Stops by Average Number of People Boarding </h2></div>');
  getBoardingData('riderships/boarding_average_graph', 'blue');
{'fraction_non_alphanumeric': 0.18370197904540164, 'fraction_numerical': 0.015832363213038415, 'mean_word_length': 3.296, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3194730', 'n_tokens_mistral': 1524, 'n_tokens_neox': 1469, 'n_words': 332}