henrywhitaker3 / Speedtest-Tracker

Continuously track your internet speed
GNU General Public License v3.0
1.52k stars 121 forks source link

[Feature Request] Second Y-Axis Charts #462

Open qu4ckth3duck opened 3 years ago

qu4ckth3duck commented 3 years ago

Describe the feature Include an option to use a Second Y-Axis on Download/Upload Chart; eg Left for Download, Right for Upload This would help make Upload more visible than an almost flat line at the bottom of the current chart for those that do not have symmetric Upload/Download

Current D/U chart: image

Mockup: image

philippjess commented 3 years ago

Same for me. I pay for 1000 MBit/s down, 50 MBit/s up. Down is near perfect, but up is problematic and always between 2 MBit/s and 20 MBit/s. To be able to see any graph with valuable information i have to export the data as csv and render it in excel. Thats why I also would really like an option to seperate both graphs or enable a second Y-Axis. Anyway, thank you for this great tool! It provides me valuable data that i can use against my monopolistic ISP.

philippjess commented 3 years ago

Necessary Changes to HistoryGraph.js in Line 47 to duData.datasets[] (add both yAxisID to the datasets):

datasets:[
    {
        data: [],
        label: 'Download',
        borderColor: "#fca503",
        fill: false,
        yAxisID: 'y-axis-1',
    },
    {
        data: [],
        label: 'Upload',
        borderColor: "#3e95cd",
        fill: false,
        yAxisID: 'y-axis-2',
    }
],

Changes to duOptions.scales in Line 76 (74 before the other edits) (add yAxes):

yAxes: [
  {
    type: 'linear',
    display: true,
    position: 'left',
    id: 'y-axis-1',
  },
  {
    type: 'linear',
    display: true,
    position: 'right',
    id: 'y-axis-2',
    gridLines: {
      drawOnArea: false,
    },
  },
]

Result: image

Do you accept MRs?

VeteraNovis commented 3 years ago

Is this solution still working? I'm able to modify the lines in HistoryGraph.js, but I can't find the duOptions.scale file.

henrywhitaker3 commented 3 years ago

Sorry, don't know how I didn't see this @philippjess. Yeah PRs welcome mate.

@VeteraNovis there is no duOptions.scale file, it will be an object somewhere in HistoryGraph.js

VeteraNovis commented 3 years ago

@henrywhitaker3 Ah thanks for the clarification!

VeteraNovis commented 3 years ago

Is this change possible to make using the docker image without rebuilding the image? Or am I going to have to clone this repo, make the changes, and then rebuild the image? I haven't looked at building my own images before and so hopefully the changes will be detected.

henrywhitaker3 commented 3 years ago

Pretty sure it'll need doing on each restart

jiriteach commented 3 years ago

Can the files in the volume be modified directly to reflect this changes like this? As I noticed these files are on the volume. I assume the image would need to be restarted for this to take affect?

philippjess commented 3 years ago

There is multiple ways to achieve this.

  1. You could fork the project, implement it in the code then do a PR.
  2. In a Dockerfile, add a layer to the image with the changes e.g. with sed, build the new image and use that.
  3. Write a script that does this on container startup, bind-mount it into the container and change the run command in your deployment.

Need help?

EDIT: Of course, solution 2, 3 and all variations of them can fail if the specific code path is changed. There is only one true solution.

ch3vr0n5 commented 2 years ago

added PR to resolve this. https://github.com/henrywhitaker3/Speedtest-Tracker/pull/854