From 8c84adc171986c76500ada59503afa92e008fcda Mon Sep 17 00:00:00 2001 From: Matthew Huntington Date: Sat, 23 Sep 2023 17:23:14 -0400 Subject: [PATCH] functionality to switch y-axis --- public/app.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/public/app.js b/public/app.js index 7de84b0..13004c0 100644 --- a/public/app.js +++ b/public/app.js @@ -227,6 +227,19 @@ const populateMetrosCoursesCheckboxes = ()=>{ }) } +const createRadioButtonHanlders = ()=>{ + d3.selectAll('input[type="radio"]') + .on('click', (event)=>{ + yAxis = event.target.value + d3.select('#y-axis').remove() + d3.select('#x-axis').remove() + d3.selectAll('#points circle').remove(); + setupGraph() + createAxes() + renderPoints() + }) +} + window.onload = async ()=>{ instances = await d3.json('/instances'); for(let instance of instances){ @@ -246,4 +259,5 @@ window.onload = async ()=>{ createAxes(); renderPoints(); createFormSubmissionHandler(); + createRadioButtonHanlders(); }