function buildMetadata(selection) {

    // Read the json data
    d3.json("samples.json").then((sampleData) => {
  
        // Filter the data to get the sample's metadata
        var filtData = sampleData.metadata;
        
        var sample = filtData.filter(item => item.id.toString() == selection)[0];
  
        // Specify the location of the metadata and update it
        var metadata = d3.select('#sample-metadata');
        metadata.html('');
        
        // Add to html
        Object.entries(sample).forEach((key) => {
            metadata.append('h5').text(key[0].toUpperCase() + ": " +key[1]+ "\n");
        });
    });
}
// Define a function that will create metadata for given sample
Define a function that will create metadata for given sample
Define a function that will create metadata for given sample
function buildMetadata(selection) {
    d3.json("samples.json").then((sampleData) => {
        var filtData = sampleData.metadata;
        var sample = filtData.filter(item => item.id.toString() == selection)[0];
        var metadata = d3.select('#sample-metadata');
        metadata.html('');
        Object.entries(sample).forEach((key) => {
            metadata.append('h5').text(key[0].toUpperCase() + ": " +key[1]+ "\n");
        });
    });
}
function buildMetadata ( selection ) { d3 . json ( "samples.json" ) . then ( ( sampleData ) => { var filtData = sampleData . metadata ; var sample = filtData . filter ( item => item . id . toString ( ) == selection ) [ 0 ] ; var metadata = d3 . select ( '#sample-metadata' ) ; metadata . html ( '' ) ; Object . entries ( sample ) . forEach ( ( key ) => { metadata . append ( 'h5' ) . text ( key [ 0 ] . toUpperCase ( ) + ": " + key [ 1 ] + "\n" ) ; } ) ; } ) ; }
Define a function that will create metadata for given sample
Define a function that will create metadata for given sample
// Read the json data // Filter the data to get the sample's metadata // Specify the location of the metadata and update it // Add to html