I have created a plot similar to this example where I am using time (in this case “year” as the facet. I also have a select filter defined that filters by “site”. The filter is working but I get both “year” values in the faceted by “year” frames?
Hi there. I just took a crack at your other question. Reading your code here, I see that you are familiar familiar w/ d3.group, so apologies if I was off the mark on that one.
For this question, I am not sure that I entirely follow what your asking / noting with “filter is working but I get both “year” values in the faceted by “year” frames?”. Your code looks like this is the desired outcome: you show two views of your data, one for each year in the dataset. When you filter by site, these views update: again, showing the specifics for each year. Could you please describe a bit more what you’d like to do differently?
Also - if it’s possible for you to share your notebook, this would help with troubleshooting/problem-solving.
The test for “auto” faceting is checking if the data in the facet is strictly equal to the data in the mark. In this case, both data are derived in the same way, but they are distinct objects, and thus no “auto” faceting happens. You can force the mark to facet by specifying facet: true. Or, by using the same derived object (which is what happens when the data.filter(…) is computed once and given a name that you then use in both places).