Open tiffanyfrance opened 1 year ago
Thank you so much for taking out time over the holidays to look at this.
I followed the instructions but I'm getting this error: climb_box.js:49 Uncaught (in promise) ReferenceError: data is not defined
I've committed my code and moved the script to climb_box.js. The html is still box.html https://github.com/salma-zahra/CAPP30239_FA22/tree/main/data
Also, in the first d3.csv function we set results as: let data = []; for (let d of results) { if (d.Sher === "Sherpa") data.push(+d.PKNAME) }
I was wondering if maybe that was hardcoding results to Sherpa and causing issues as well.
Thanks!
Hi Salma! Here are a few things for the box plot.
I noticed that this box plot calculated the ranges a bit differently. I added some new calculations for the median, min, max. Replace your calculations on lines 82-89 with:
Above the y scale, also include an x scale using scale band to get the sherpa/nonsherpa labels:
Create a reusable function with params. Move the data, the content from #1 above, and all the appending of rectangles/text into that function. Then, move the function below (outside of) the d3.csv() function. Something like:
function buildBoxPlot(results, Sher, svg, x, y) {...}
Then, at the bottom of d3.csv(), below where you set your scales and axis, you will want to call your function twice. Something like:
To recap you will have two functions: d3.csv and buildBoxPlot(). The d3.csv function will have the margin, width, height, svg declaration, x scale, x axis call, y scale, y axis call, and the two buildBoxPlot functions mentioned in #4. Everything else will live inside
function buildBoxPlot(...){....}
.Let me know if you get stuck.