weewx-highcharts problem with rainfall & US units

73 views
Skip to first unread message

MikeQ

unread,
Jun 30, 2019, 7:54:42 PM6/30/19
to weewx-user
I installed weewx-highcharts and added a page (using the sample HTML page) to my Seasons skin.  I am in the US, so I changed weewx.conf for US units and ranges:

           [[[[Groups]]]]
                group_altitude = foot
                group_speed2 = mile_per_hour2
                group_pressure = inHg
                group_rain = inch
                group_rainrate = inch_per_hour
                group_temperature = degree_F
                group_degree_day = degree_F_day
                group_speed = mile_per_hour
        [[[Extras]]]
           [[[[MinRange]]]]
               barometer = 1, inHg
               windchill = 10, degree_F
               UV = 16
               radiation = 500
               rain = 1, inch
               outTemp = 10, degree_F
               windSpeed = 10

The HTML page displays the highcharts and they all look correct except for Rainfall.  The weekly Rainfall chart has the correct y-axis units (with no rain recorded during the last week):

week_json.png






























The yearly chart y-axis units are incorrect and the pop-ups when you hover over a bar on the chart are also incorrect:


year_json.png




























I took the year.json file and ran it through an online json -> csv converter (attached).  I opened it in LibreOffice and converted epoch date/times to human-readable dates so I could verify there were no bad records in the json file.  It looks fine.

If I hover over the bar for 31 May, I get 0.4 and in the json file it is 0.41
If I hover over the bar for 2 June, I get 0.0 and it should be 0.04
If I hover over the bar for 3 June, I get 0.1 and it should be 0.13

So, it appears like the extension is having a problem with my 100ths of an inch values (0.01 inches).

Any ideas on how to fix this? Thanks.
Rainplot.csv

gjr80

unread,
Jul 6, 2019, 9:42:59 PM7/6/19
to weewx-user
Hi,

Looks like I have a couple of highcharts settings that are either wrong or incorrectly set when changing from mm to inches. Unfortunately I don’t have access to my PC for the next couple of months so the best I can do is a workaround where I give you some instructions for making a couple of minor changes to one of the weewx-highcharts files. On top of that, since I don’t have access to my PC I can’t verify the workarounds. If you are not comfortable with this and editing the file then I am afraid a fix will have to wait a couple of months.

If you wish to go ahead proceed as follows:

1. As part of setting up a web page to display the highcharts plots you will have copied the file plot.js to your web server, find it and make a backup copy, let’s call it plot_orig.js

2. To fix the tool tip decimal places issue edit plot.js on your web server and at line 809 change:

obj.tooltip.valueDecimals = 1;

to

obj.tooltip.valueDecimals = 2;

3. To fix the y axis values goto line 817 and change:

format: '{value:.0f}',

to

format: '{value:.1f}',

4. Save plot.js, goto your highcharts plot page and refresh the page. Depending on your browser you may need to clear the browser cache.

Let us know how that goes. If you need to revert just delete the modified plot.js and then copy plot_orig.js back as plot.js.

Gary

MikeQ

unread,
Jul 7, 2019, 1:29:40 PM7/7/19
to weewx-user
Gary -

Thanks for the easy fix!  Those two edits fixed the problem.

Just a couple of notes in case someone else tries to use this fix in the future:
1.  My file is plots.js instead of plot.js
2.  The lines I needed to edit were off one line number in my plots.js file which was easy enough to figure out - 810 instead of 809 & 818 instead of 817.

Thanks,
Mike

gjr80

unread,
Jul 9, 2019, 5:35:26 PM7/9/19
to weewx-user
My mistake, can’t read my own repo, plots.js is of course the correct file. Line numbers will likely vary slightly depending on commits.

Gary
Reply all
Reply to author
Forward
0 new messages