nuget-trends icon indicating copy to clipboard operation
nuget-trends copied to clipboard

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

Open KristofferStrube opened this issue 3 years ago • 5 comments

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.

KristofferStrube avatar Dec 20 '21 22:12 KristofferStrube

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.

bruno-garcia avatar Jan 11 '22 02:01 bruno-garcia

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

joaopgrassi avatar Jan 16 '22 13:01 joaopgrassi

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?

KristofferStrube avatar Jan 28 '22 12:01 KristofferStrube

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.

joaopgrassi avatar Jan 30 '22 18:01 joaopgrassi

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.

KristofferStrube avatar Jan 30 '22 18:01 KristofferStrube