Toggle Between Two Multi-Series Line Charts in Plot


I apologize in advance for the messy code as I am still learning.

I have an input set up to toggle between two multi-series line charts. I have the names of the charts as values in the toggle input. When the notebook loads it shows both charts even though I would like it to just show the pre-selected chart to start. In addition to this I have added an animation function imported from another notebook that I would like to be triggered when I toggle between the two charts. But currently it is only triggered when I hit the replay button or when it is visible when the notebook loads. Here is the link to my notebook.

As an aside, in Arquero I filtered the top average point scorers (that played at least ten seasons) and then filtered each individual name in Plot. But I know there is probably an easier way to code this. Would I be able to do all of the data transformations in Plot itself? I tried to create a json dataset with Arquero, but I did not know how to convert the season variable to a string. Currently, it is showing as an invalid date.

Thanks in advance,

Hey Scott!

Thanks for taking the time to put your question here, and sorry for the slow reply. I’ve created a fork of your notebook that takes a different approach to managing which chart you show (using a view as an interesting idea, but it’s tricky to conditionally show cells). It uses functions to render the charts, rather than storing them as cells.

In terms of your arquero question, I’m not sure what exactly is happening with the date parsing, but you should be able to use your data variable in Arquero without the date issue:

// Displays the season as strings

Hope that helps, let me know if you have any questions!

Thank you so much! This is very helpful. I didn’t know you could make the plots into functions like that.