Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logarithmic scale #200

Open
swharden opened this issue Jul 12, 2022 · 3 comments
Open

Logarithmic scale #200

swharden opened this issue Jul 12, 2022 · 3 comments
Labels
enhancement New feature or request new-feature

Comments

@swharden
Copy link

Download count for popular packages typically follows an exponential growth curve (e.g., screenshot in #189). By plotting exponential curves on a log-scaled Y axis they appear as straight lines, making it easier to compare multiple exponential curves to one another. It's hard to eyeball whether growth differs between curves that start at different time points (e.g., an old exponentially growing package vs. a newer one), and adding support for log-scaled vertical axes solves that problem.

Would you consider adding a checkbox to present data on a log-scaled axis? If there's interest in this I can try to figure out how to implement it properly and I'll open a PR. I'm not familiar with Angular, but I can try my best. If this feature isn't desired or you think the checkbox would be added UI clutter, no worries! I wanted to ask before I worked on this further.

Here's a quick mockup of what it could look like, although it looks like charts.js is struggling with missing data points (their log is being interpreted as zero).

Linear Y Axis Logarithmic Y Axis
image image

To create the mockup I modified this file according to the Chart.js 2.9 Log axis docs

yAxes: [{
display: true,
ticks: {

        yAxes: [{
          display: true,
          type: 'logarithmic',
          ticks: {
@joaopgrassi
Copy link
Member

joaopgrassi commented Jul 13, 2022

Hey @swharden!

I think this makes sense, and would be something cool to have!

Regarding the "checkbox" I don't really know where we could add it. I had some ideas to add some more "advanced" filters/options so I think this is another one for the bucket. I was leaning towards having either some sort of "expandable" component above the list of package/tags that one could expand to see all the "advanced" filters/options. Another alternative would be a dialog but.. not sure that's a good UI/UX.

You could just start with it, and add the new option on the side of the drop-down for the period and we can see how to go from there.

Another thing is we are using a prob old version of chart.js, I looked once to upgrade it and there were several breaking changes :( so.. not sure if that's going to impact on this change.

Here's a quick mockup of what it could look like, although it looks like charts.js is struggling with missing data points (their log is being interpreted as zero).

The code that returns the data returns 0 on purpose so we could handle situations where you compare two packages and one of them didn't exist at the same period.

For ex: Say you select a period of 2 years and 2 packages. The second package only started existing on the second year. In this case, the line for the second package was being plotted at the start of the chart, and not exactly where it should be (middle). I remember i tried several things and the end we went with this approach. Here's an example: https://nugt.net/s/iIXU1a8

@joaopgrassi joaopgrassi added enhancement New feature or request new-feature labels Jul 13, 2022
@swharden
Copy link
Author

swharden commented Jul 13, 2022

To explore these concepts I made a little WinForms application using ScottPlot.net and some of the JSON files retrieved using the NuGetTrends.com API: https://github.com/swharden/NuGet-Stats-Analysis

This demonstrates what log scaling the data looks like, how it facilitates comparing download rates across multiple packages, and also what it looks like if you add a checkbox to align packages by the date of their first upload.

nuget-log2

I think this is sufficient to communicate what this type of functionality could look like if implemented in the web viewer.

good UI/UX

I agree it will be important to get this right. An expanding panel with additional graph options is a good idea. Upgrading chart.js at the same time makes sense.

You could just start with it

I'm not familiar enough with Angular (or talented enough with UI/UX) to feel like I'm the best person to implement this. I'm happy to leave this issue here as a reference for whoever wants to pick this up in the future, and it can be closed if it's not actionable.

Thanks again for your input and all the work you do for this project! I really value the information it provides, and am very happy this web app exists 🚀✨

@joaopgrassi
Copy link
Member

Whoa great stuff, thanks for the sample!

No problem. Let's leave the issue open, I think this would be a good new feature.

I can tackle it when I have some free cycles or someone else can of course. Also, if you want to learn Angular and etc I could also help you get started 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request new-feature
Projects
None yet
Development

No branches or pull requests

2 participants