zengm-games / zengm

Basketball GM (and other ZenGM games) are single-player sports management simulation games, made entirely in client-side JavaScript.
https://zengm.com
Other
349 stars 127 forks source link

Add graphics for player stats #438

Closed luso97 closed 1 year ago

luso97 commented 1 year ago

In this MR I added a page that create graphics with the stats of the players. It´s in theory a first draft, more could be done in that page. The page is added to the left side menu, don´t know if that´s a good approach though.

luso97 commented 1 year ago

graphs

dumbmatter commented 1 year ago

It is definitely a good idea to have some kind of flexible graph tool like this.

Some drawbacks of the current UI (just judging from the screenshot, I haven't actually run it!): you can't compare as many things as people want. Like you can compare advanced stats against other advanced stats, but what about BPM versus PPG? What about PPG this season vs PPG last season? There's a limit to what is reasonable, you can't support everything, but I feel like those are things people would want. So basically, the modifiers in the top bar would have to come down and be able to be set separately for each axis.

Would also be nice to include player ratings!

Then eventually make a team stats version... but that's for the future!

If possible, could you use visx to draw the chart rather than chart.js? Just because I'm already using visx for other charts in the game. If you don't want to deal with this, that's fine.

More generally, don't feel obligated to do all this yourself, you can let me finish it at any point.

One thing I would definitely appreciate your feedback on... are there websites that offer tools like this for NBA or other pro sports stats? Off the top of my head, I don't know. But if there are, that would be good to look at for UI ideas. @nicidob and @ClevelandFan295 might also have some good ideas.

luso97 commented 1 year ago

The comparing of multiple stuff I agree, would make this much better. About visx I´ll take a look, chart js actually gave me some issues in Chrome (the graph would get smaller) so maybe this is a workaround. I´ll take a look at other sites, but yes I´m open to suggestions, I´m the opposite of an UX expert myself.

luso97 commented 1 year ago

Already moved to visx, added the comparison between different types of stats and also added contract and ratings to the mix of things you can compare. Still some issues with the UI being ugly, linting issues and failing some times when first loading, etc. but most of the work I think is done.

luso97 commented 1 year ago

I believe this is finished. Now it´s working with other types of stats like ratings and contracts. I also added a best fit line. Here´s a screenshot when asking for amount in contract and overall. A next addition like you mentioned could be a team stat graphs. I think the code here can be reused. The scatterplot at least is generic.

I have put the graphs as a item in the sidemenu, don´t know where it would be best to put it.

github

luso97 commented 1 year ago

@dumbmatter This is done btw, just removed chart js and I can´t anything else to do

dumbmatter commented 1 year ago

This is actually really dope. There's a bunch of little things I want to change/improve, but I'm not going to make you do that after I let this PR sit here for 3 months with no feedback! So I will take it from here and this will probably be the next new feature.

dumbmatter commented 1 year ago

@luso97 I'm working on this in the player-graphs branch if you're curious... probably will be another couple days at least before I'm done all the little things I want to tweak :)

luso97 commented 1 year ago

Just saw it, looks much cleaner now, glad to help with the game!