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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial implementation of custom scale for network charts. WIP. Fixes #844. #1746

Conversation

victor-marino
Copy link
Contributor

@victor-marino victor-marino commented Dec 27, 2023

Please note, this is my first time ever developing for MacOS, or using Swift, or even using Xcode for development 馃槄

As a result, I apologize in advance for any errors or terrible practices I may have used here!

What's implemented:

  • New toggle to enable/disable the Custom Scale option
  • New text field to enter the maximum desired bandwidth for the chart (in Mbps)
  • Settings added under the Network settings panel for both the widget and the pop-up charts
  • Both charts will pick up the new value as soon as the text field is modified (if the toggle is enabled)

Things I couldn't figure out how to do by myself:

  • Hide or disable the input text field when the toggle is disabled. Looked up some state management tutorials but wasn't able to make it work here.
  • Sanitize the input of the text field to allow only numerical digits.
  • Allow entering separate values for the download and upload speed. Couldn't figure out how to identify which text field was notifying the changes, so I went with a single text field for now.

Hope this is at least helpful as a starting point ;-)

@victor-marino
Copy link
Contributor Author

@exelban, did you get a chance to look into this? Any feedback?

Regarding the To-Do's:
If you don't have the time to work on the pending UI stuff, I was thinking maybe we could simplify it by removing the toggle altogether. Instead, the feature could be turned on or off just based on whether the user enters a value in the text field or leaves it empty (I've seen you've done this with other settings in the app).

Let me know what you think 馃槈

@exelban
Copy link
Owner

exelban commented Jan 13, 2024

I don't have a time. Will take a look next week. But I'm not sure I understand what do you want to archive with feature.

@victor-marino
Copy link
Contributor Author

victor-marino commented Jan 13, 2024

Great, thanks a lot.

But I'm not sure I understand what do you want to archive with feature.

Ok, I'll try to explain.

Right now, Stats will always modify the scale of the network charts dynamically. Meaning, if your maximum DL speed for the visible period is, say, 10 Kbps, the maximum value of the chart will be 10 Kbps. If there's a traffic spike to something like 100 Mbps (during a download), the chart will scale to that value, and so the 10 Kbps traffic will become invisible (as it should be... it was probably just background traffic). But once that 100 Mbps spike leaves the chart, it will suddenly scale back to whatever the new "maximum" is, and those little 10 Kbps spikes will again take over the whole chart.

This behaviour is fine for certain use cases... but is really bad for others.

First of all, it's frustratingly inconsistent. The chart being maxed out could mean I just downloaded a full GB of data, and a few minutes later, that same chart being maxed out could just be showing some background traffic. Without looking at the scale, the plot tells me nothing because it isn't consistent. Having to double check the scale every second makes for a sub-optimal UX and can cause confusion.

Second, because the widget chart doesn't have a scale, that particular chart tells you almost nothing all the time. You can only rely on the actual speed numbers, but not on the chart.

Third, as a consequence of the previous point, you also lose the ability to use the widget chart as a handy "warning" for abnormal traffic. Right now, I can't assume that a maxed out chart means I just downloaded anything, because the chart is always maxed out!

And finally, you also lose the ability to use the chart as a measure of how congested your internet connection is. Any traffic will put it at 100%, so it looks as if your internet connection is always fully utilized, even when there's only background traffic.

For these reasons, many traffic monitor apps allow you to set a fixed scale, which you will often want to set as the maximum speed of your home broadband connection (e.g.: 1 Gbps). Here's a screenshot from DU Meter, probably the most popular traffic monitor app for Windows:
imagen

If you think of your internet connection as a "water pipe", setting the scale to match your max broadband speed will turn the chart (and especially the widget chart) into a graphical representation of how full that pipe has been for the past few seconds. This way, the chart stays pretty much empty unless I'm actually doing some significant traffic, which is exactly what I want. In other words, I want the chart to act as a percentage representation of my internet connection usage. So if I'm downloading at 1 Gbps on my 1 Gbps fiber connection, I want the chart to be 100% full. And if I'm downloading at 500 Mbps, I want the chart to be at 50%.

I'm a network engineer myself, and I can't tell you how useful it is to just glance at the chart and know how congested my internet connection is without having to even look at the numbers or click anything. For instance, if I'm browsing the web and things are slow, a quick glance at the chart may already show my pipe has been full for a while, so no need to even open the pop-up. For me it's really the number 1 feature I go looking for when using any traffic monitoring app.

I understand this may not be the desired behaviour for everybody, which is why it should be optional. But I hope you can at least understand the value of including it as an option 馃槈

@exelban
Copy link
Owner

exelban commented Jan 19, 2024

hi. Sorry, but have no time this week.
But read a few times and understand the problem.

Looking at this PR there are a lot of things that are not finished: all the todos that you leave.
It will not merged to the project in this stage. There are 2 options now: you can finish the PR by doing all TODO or transform this PR to the issue and I will implement this feature when will have time.

Also what about the situation when io goes over the limit? How to represent that if there is be locked max value?

@victor-marino
Copy link
Contributor Author

Hi.

Sorry, but have no time this week.
No worries at all. I really appreciate you looking into it whenever you can, and I'm just happy to contribute to the project and improve the app.

There are 2 options now: you can finish the PR by doing all TODO or transform this PR to the issue and I will implement this feature when will have time.

We will have to go with option 2 unfortunately. I'd love to help more, but as said I'm a complete noob in MacOS development and I simply don't know how to complete the missing parts. I think it should be relatively simple though (mostly some UI tweaks), but I think it's best if you do it yourself, whenever you get some time.

What do you mean by "transform" this into the issue? Just reopen the issue so you can track it properly? Or is there anything else I should do?

Also what about the situation when io goes over the limit? How to represent that if there is be locked max value?

The chart will simply be maxed out (saturated, completely filled). This is what happens already with my current implementation in the PR.

I don't think that's a problem, as it's how all apps handle it, or at least all the apps I've seen. It's probably what users will expect when enabling this feature.

@exelban
Copy link
Owner

exelban commented Jan 20, 2024

it will be enough to open the issue with a proposal. And copy past your messages there. Also you can notice that PR.

What do you mean the chart will be maxed out? If there will be a fixed max value how could it go out from that range?

@victor-marino
Copy link
Contributor Author

it will be enough to open the issue with a proposal. And copy past your messages there. Also you can notice that PR.

Ok, will do 馃憤馃徎

What do you mean the chart will be maxed out? If there will be a fixed max value how could it go out from that range?

Sorry, I didn't explain myself properly. By "maxed out" I mean the chart will simply be full, at 100%.

If the scale is set to 1 Gbps but your throughput is 1.1 Gbps, then the graphical representation will be the same as if the throughput was 1 Gbps. The numeric values will allow you to see the real value of course.

If you test my PR you'll see the chart simply goes to 100% in this case.

The nice thing is, if the user expects this to happen frequently (e.g.. some ISPs "overprovision" fiber speeds), you can always set the max value to be something like 10% higher than your "official speed" (1.2 Gbps in this case).

@victor-marino
Copy link
Contributor Author

New issue created: #1787

@exelban exelban closed this Jan 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants