dotnet / nuget-trends

Check out NuGet packages adoption and what's trending on NuGet.
https://nugettrends.com
MIT License
146 stars 25 forks source link

Tough to read years from the main plot when showing multiple years. #181

Open KristofferStrube opened 2 years ago

KristofferStrube commented 2 years ago

Problem

When plotting the downloads for a package over multiple years we have a 'MMM d' format as the label for the x-axis and the same for the tooltip title when hovering over a specific data-point. This can make it tough to read which year a specific data point is for.

Solutions

Simple solution

The most simple solution that would require minimal changes would be to set the title of the tooltip explicitly to include the year. This can be done here in packages.ts by adding a title property. This keeps the plot simple on the surface but makes it possible to inspect the full date if you can't figure out the year.

Less simple solution

Have the x-axis labels depend on whether or not we are plotting for 1 year or more. I can't figure out specifically where this should be done but should be doable with more changes to the packages.ts code. I'm not sure how pretty this will be code-quality-wise.

bruno-garcia commented 2 years ago

Agreed! This is something that I always noticed too but never got around to change.

I personally don't have an opinion on which route to take as a solution (@joaopgrassi might have one). But happy to review a PR and get this changed and released.

joaopgrassi commented 2 years ago

@KristofferStrube if you have time to send a PR, we can go with the simple solution first and see how it looks.

KristofferStrube commented 2 years ago

Hey @joaopgrassi and @bruno-garcia , I have tried to load the PostgreSQL data in, in order to try out the simple approach, but I don't seem to get any data points in my test project. I get the different package names, but not the download counts themselves, so I can't test if my approach would work. Is there something specifically I have to do with the database backup to get this or am I just unlucky?

joaopgrassi commented 2 years ago

Hum strange. I guess you used the contrib db from here: https://github.com/dotnet/nuget-trends#database-backup-for-contributors?

I haven't use it in a while, but last time I did it worked. My "go-to" packages to try-out things are usually the popular ones like EntityFramework, Dapper or xUnit and the like. Maybe try one of those?

If I have time this week I'll try setting up from scratch to see if I run into problems.

KristofferStrube commented 2 years ago

Yep @joaopgrassi I used that backup.

I will try to look at using one of those packages to check the import again.

And thanks. There were some hoops to jump through to get it to work without prior setup, but I think I got there.