UFO Data Exploration Site with Filters

Creates a styled website with an interactive table based on a dataset of reported UFO sightings. Uses javascript (and d3), html, and css.

Github Repository

Page loads with dynamic header, then user filters table for sightings located in El Cajon, CA

HTML, Javascript (D3) to load table into main page

function buildHTMLTable(incomingData) {
  //remove leftover rows
  var oldRows = d3.select("tbody").selectAll("tr");
  //Print table
  var printTable = d3.select("tbody");
  incomingData.forEach(function (tableObject) {
    //Make a row for each object in table
    var row = printTable.append("tr");
    //Print values within each object
    Object.entries(tableObject).forEach(([key, value]) => {
      var cell = row.append("td");

Input filters listen for inputs and rebuild table using javascript

function runEnter() {
  //Prevent the page from refreshing

  //Select the input element and get the raw HTML node
  var dateField = d3.select("#datetime");
  var cityField = d3.select("#cityInput");
  //Get the value property of the input element
  var dateValue = dateField.property("value");
  var cityValue = cityField.property("value");
  var stateValue = stateField.property("value");

  //Filter array for final table
  //Set to full data set to start
  tableFiltered = data;

  //If dateValue.length > 0, filter for date
  let dateFilter = [];
  if (dateValue.length > 0) {
    tableData.forEach(function (item) {
      if (item.datetime === dateValue) {
  //Establish array to store filtered by state data
  let stateFilter = [];

  //If state field has a value, filter for state
  if (stateValue.length > 0) {
    tableFiltered.forEach(function (item) {
      if (item.state === stateValue) {
    tableFiltered = stateFilter;


  //Possibility: none of the filters narrowed down tableFiltered, so original table should be output
  if (tableFiltered === data) {
  } else {