jeroenheijmans / advent-of-code-charts

Inject charts in your private leaderboard page for Advent of Code
MIT License
118 stars 21 forks source link

Persist selection of series for graphs #90

Open SuperTux88 opened 1 year ago

SuperTux88 commented 1 year ago

I think it would be nice, if the selection for the graphs was stored and doesn't reset when reloading the page. I think this is mostly useful for the "Minutes taken per star" graph, as this now per default only shows myself. The old version hardcoded showed the top 3 people (which wasn't always useful, so I appreciate being able to enable different people), but now with only myself per default, I always need to select the others I want to compare with again.

jeroenheijmans commented 1 year ago

Thanks for sharing your thoughts!

I presume you meant by "selection" the enable/disable of series in graphs? So which players were enabled via the legend?

That does sound like a good feature, albeit with a bunch of edge cases to think about (where people change user names, and folks join or leave leaderboards). So takes a bunch of care to implement, but otherwise seems solid to me (perhaps even as a per-leaderboard persisted default situation).

SuperTux88 commented 1 year ago

Yes, it would need to be persisted per leaderboard (otherwise switching between leaderboards would be a bit chaotic). But otherwise I would keep it pretty simple. So for the last graph just save the users that were manually enabled, for the other graphs store which were disabled. And for new users just use the default (so enabled for the first 3, and disabled for the last) and if a user left that was persisted just drop it. And I would persist the users with the ID, so renaming shouldn't be an issue.