From 0dfad501296dd47a41506420f986fc2259640cf0 Mon Sep 17 00:00:00 2001 From: Matthew Huntington Date: Sat, 23 Sep 2023 00:06:26 -0400 Subject: [PATCH] fixed html('') issue --- public/app.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/public/app.js b/public/app.js index 2a1deaa..3369d15 100644 --- a/public/app.js +++ b/public/app.js @@ -1,4 +1,3 @@ -// TODO - filter by course // TODO - change y axis to dropped const WIDTH = 800; const HEIGHT = 600; @@ -148,24 +147,30 @@ const createFormSubmissionHandler = () => { const populateMetrosCoursesCheckboxes = ()=>{ - d3.select('#courses ul').html('') //TODO remove .html() somehow + d3.select('#courses ul') .selectAll('li') .data(courses) .enter() - .append('li').text(d => d.course) - .append('input').attr('type', 'checkbox') + .append('li') + .text(d => d.course) + .append('input') + d3.selectAll('#courses ul li input') + .attr('type', 'checkbox') .property('checked', d => d.checked) .on('click', (event, datum)=>{ datum.checked = !datum.checked renderPoints() }) - d3.select('#metros ul').html('') //TODO remove .html() somehow + d3.select('#metros ul') .selectAll('li') .data(metros) .enter() - .append('li').text(d => d.metro) - .append('input').attr('type', 'checkbox') + .append('li') + .text(d => d.metro) + .append('input') + d3.selectAll('#metros ul li input') + .attr('type', 'checkbox') .property('checked', d => d.checked) .on('click', (event, datum)=>{ datum.checked = !datum.checked