app.js
// Update demographic panel with change in drop down
Update demographic panel with change in drop down
Update demographic panel with change in drop down
function updateMetaData(samples) {
    d3.json('samples2.json').then(data => {
      let metaSamples = data.metadata.filter(metaID => metaID.id == samples);
      let demoResults = metaSamples[0];
      let panel = d3.select("#sample-metadata")
      panel.html("");
      Object.entries(demoResults).forEach(([key, value]) => {
        panel.append("h6").text(`${key}: ${value}`);
      });
    });
}
function updateMetaData ( samples ) { d3 . json ( 'samples2.json' ) . then ( data => { let metaSamples = data . metadata . filter ( metaID => metaID . id == samples ) ; let demoResults = metaSamples [ 0 ] ; let panel = d3 . select ( "#sample-metadata" ) panel . html ( "" ) ; Object . entries ( demoResults ) . forEach ( ( [ key , value ] ) => { panel . append ( "h6" ) . text ( ` ${ key } ${ value } ` ) ; } ) ; } ) ; }
Update demographic panel with change in drop down
Update demographic panel with change in drop down
// Use D3 library to read in samples.json to select the dropdown menu // filtering data by the input value // use d3 to select the demographics panel // clear the previous data // 5. Display each key-value pair from the metadata JSON object somewhere on the page. // iterate through keys JavaScript 02-Activities, 06 & 07 // append on the panel variable for correct key values