Author Topic: Scale on right side of graphs  (Read 1252 times)

0 Members and 1 Guest are viewing this topic.

Offline bobskisan

  • Member
  • *
  • Posts: 3
    • Flymanilla
Scale on right side of graphs
« on: March 22, 2019, 07:00:06 PM »
If anyone is interested in having the same scale that is on the left of graphs also on the right side I have a modified genplot.py file that does this.
This is a link to our weather page http://www.flymanilla.com/Home/MtBorahWeather/tabid/339/Default.aspx if you want to check this out.
This page is for a paragliding site where pilots generally look at this page on their mobile phones. Our main purpose was to check the wind conditions and the graphs were the best way to see the trend for the wind strength. It was frustrating looking at the graphs and having to scroll back to the left side all the time to check the scale hence the modification to the graphs.
What is the best way to get this incorporated into weewx? I've looked at github but haven't had time to sort it out yet.

Bob

Offline pila

  • Member
  • *
  • Posts: 9
Re: Scale on right side of graphs
« Reply #1 on: September 15, 2019, 10:03:12 AM »
Lot of traffic here, I see :(

Yes please. If you are still willing, please send this to me via e-mail. Maybe include few words where this file goes, but I trust I will get it :)

Offline bobskisan

  • Member
  • *
  • Posts: 3
    • Flymanilla
Re: Scale on right side of graphs
« Reply #2 on: September 16, 2019, 11:12:48 PM »
Hi pila,
Please find  a file called genplot.py  at this link https://1drv.ms/u/s!AlqZFLIfYlbqkSoBtVu5PeJaOcU8?e=GsUL6o

Where you need to save it depends on how you installed.
Depending on how you installed, there are a bunch of different directory layouts.
eg you might have everything under /home/weewx/
or you might have executable in /usr/bin/weewxd and skins in /etc/weewx/skins etc.

Your executables will be under a folder called /bin/ (binaries) and genplot.py
 will be in bin/weeplot/genplot.py


Before you install:
* cd into your "executable" directory
* Keep a backup of the current genplot.py file
  "cp bin/weeplot/genplot.py bin/weeplot/genplot.py.bk"
  If the shit hits the fan, you can restore this backup file and go back to original behaviour.

To Install:
* cp the attached genplot.py to bin/weeplot/genplot.py
* Update your Standard skin: skins/Standard/skin.conf
  You need to add "repeat_y_label_on_rhs = true" to whichever charts you want to have the label on the right hand side.
  Like other settings you can set at higher levels, and override at lower levels.
  eg I added it for all "Day" plots like so:
 
    [[day_images]]
        x_label_format = %H:%M
        bottom_label_format = %x %X
        time_length = 97200    # == 27 hours
        repeat_y_label_on_rhs = true
       
* restart weewx
  How you do this is going to depend on whether you run as a daemon or not.
  I will assume you know how to do it
* Test that it works :)
  I tested on v3.8.2
  weewx only re-creates the images once every 5 minutes, but instead of waiting you can force it to redraw them all by calling "bin/wee_reports" in the terminal.
  You should end up with something like this:
 

Hope this helps,
let me know if any of the instructions are not clear or it doesn't work.
File is at this link https://1drv.ms/u/s!AlqZFLIfYlbqkSoBtVu5PeJaOcU8?e=GsUL6o

Bob Smith

Offline pila

  • Member
  • *
  • Posts: 9
Re: Scale on right side of graphs
« Reply #3 on: September 17, 2019, 05:59:50 AM »
Brilliant. This should have been a default polot look. Weews is excellent, but this was bugging me a lot! Many thanks. Your instructions are sufficient even for a begginer. I believe we do not need to restart weewx since we are not changing anything in its config, only skins?

As they taught people in IBM to speak with customers: Yes, but... In my case, Yes it works great but I have two issues.

I use Seasons and Smartphone skins. Since I beleive this right labes should be stock, I added them to every graph. But, I get right hand numbers on day and week in Seasons, but no month and year graphs. In Smartphone, I get right hand labels only on day, and not in week or month (no year shown here). Tried the Standard skin - the same. So, my guess is this is somhow inbuild into your script and you fixed right hand side only some graphs.

Second tiny issue is almost irrelevant: I use Smartphone skin and plan to make it my SmartHome base page (plan on not using anything third party for SmartHome). It is black. And then I can see white graphs have no white margin after the right hand numbers. They also have bit too much of white margin on the left hand side, but that is not up to you. A tiny correction of these white margins so they are small but symetricall would be perfect.

i will try peeking into the source, I have to learn Python anyway :) And how to make HTML buttons :)) on SmartPhone page. Once again: many thanks!

Offline bobskisan

  • Member
  • *
  • Posts: 3
    • Flymanilla
Re: Scale on right side of graphs
« Reply #4 on: September 17, 2019, 06:11:19 AM »
Works on all my graphs. Maybe you haven’t put the graphs config in the correct conf files.

Bob Smith

Offline pila

  • Member
  • *
  • Posts: 9
Re: Scale on right side of graphs
« Reply #5 on: September 17, 2019, 06:53:36 AM »
In the meantime, I peeked. Your file differs from mine (I have installed 2 weks ago).

At the beginning, it was lacking

import os

I pasted it and regneerated and now all seems good. In Seasons I still do not have right hand labes on year graphs. Maybe not all reports are generated all the times? Browser cache? OK, detele all reports, regnerate ....  Clear cache.... Yes, that was the problem.

All seems well now. Margins also look normal (too big for me but I will try slimming white space a bit on my own).

OK; you were right, your mod works perfectly fine! Apologize for insulting your great work :)))

Offline pila

  • Member
  • *
  • Posts: 9
Re: Scale on right side of graphs
« Reply #6 on: September 17, 2019, 08:06:17 AM »
Weewx should really incorporate this feature as a default.

 

anything