Okay, good. Now we’re getting somewhere. I agree, what I was doing is hacky. And I don’t want to be digging into the stack where users have no business poking around. I hear your point about mutating variables outside of callbacks. Though I am new to web development, I think that Flask has something similar going on with the app context, except that they throw an exception when you try to do something outside of context.
But on the other hand, copy.copy isn’t going to work, because I do need each checklist item to persist. I could make another singleton object whose object is to watch over that
Below you can see the effect: I can add the “1” checkbox or the “2” checkbox, but not both:
http://recordit.co/qRtMOGTvIg
So, you’re probably wondering why I want to do this. And it may be that there is already an example in the user guide. I’ll go back and double-check the tutorials.
In the meantime, imagine having hundreds, or thousands of datasets, and you can’t load all of them. But you have a “search function” that returns certain datasets based on some criteria. You then select a subset of the list returned by the “search function”, and add those to a list of candidate datasets.
You then perform another search, or several searches, choosing datasets to add to your list of candidate datasets (and store them in a CheckList
).
Once you are satisfied with your list, you can select a subset from the list of candidate datasets, and then plot only those datasets. (You do this by selecting from the CheckList
.)
This is essentially “slicing” by year, based on the sliders, in the examples. Except that “years” are sequential, and can be indexed with a slider. (also, in this example we would be slicing twice)
There is probably a better way of doing this… Plotly comes with one out of the box: When you have multiple traces within a single plot, you get a legend, and you can choose which traces to turn on or off.
But what happens when you have 10 plots, and each one has 2 traces each. Do you really want to scroll through all 10 and turn off one trace in each plot?
If this is too complicated, I understand that it is a sign that I need to step back and think more about the architecture…