Here, data1 and data2 work but my dataJoined does not work when you try to slice it. I am guessing it's because data1 and 2 are of a different data type so Im guessing the joined just needs to be parsed into the correct data type.
I think it has something to do with the Line of:
if (stateTimeSeriesData[d.properties.name]) {
createStateChart(
"#state-chart",
stateTimeSeriesData[d.properties.name],
d.properties.name
);
}
I believe something is happening where the program doesnt recognize that we have data for the state and so nothing is showing up. You can clearly see where it has been blocked off for us to have a second data table but there is nothing showing up there when you click on the state. Note: there is only sample data at this time so the only state that should be working is California but even that doesn't work. If you could figure out what might be causing this issue that would be great, my goal is just to get something working with just random sample data and then try to add actual data after; weather that be before or after the deliverable on thursday
respect for plowing through some raw d3 code. like i commented earlier it's not necessary to go this deep for simple charts like these, Plot charts would suffice, but hopefully you learn the deep stuff then.
whether you're writing it by hand or proompting it's important to be able to understand what's going on and find out where exactly it goes wrong
are you using devtools? use it, it would show you the error directly with some red scary lines, from there you can click on the specific line of code that errors, add breakpoints and examine the values as the code progresses
your mistake was to make a sweeping selection like
// Reset all states to original color
mapSvg.selectAll("path").attr("fill", d => {
and then assume that d would be available all the time
in fact mapSvg now has some "path" elements that don't have any data attached to them specifically the x-axis of the line chart, so it crashes when trying to get d.properties of d that is null
what do? add a unique class to your map areas and d3.selectAll using that unique class