Belchertown Graphs, a week of daily rain in "columns"

114 views
Skip to first unread message

Jeff Rabin

unread,
Jun 9, 2020, 9:53:59 AM6/9/20
to weewx-user
I am playing with graphs and I would like to have the rain totals displayed as daily totals in columns.   I've got it working, but when the month is rolling over it sorts the columns by the day.   

For example, on June 3rd it showed: 
  • columns listed as 1, 2, 3, 28, 29, 30, 31
  • I would like to have it displayed as 28, 29, 30, 31, 1, 2, 3


Code:

[week]


    # Chart Timespan Defaults


    title = "Last 7 Days"


    show_button = true


    button_text = "Week"


    time_length = 604800 # Last 7 days


    tooltip_date_format = "LLL"


    aggregate_type = max


    aggregate_interval = 3600 # 1 hour


    gapsize = 3600000 # 1 hour in milliseconds




    [[chart1]]


        title = Temperature


        [[[outTemp]]]


            zIndex = 1


            name = Temperature


        [[[inTemp]]]


            name = Inside


        [[[windchill]]]


        [[[heatindex]]]


            color = "#f7a35c"


        [[[dewpoint]]]


            color = purple




    [[chart2]]


        title = Rain


        type = column


        xAxis_groupby = day


        [[[rainTotal]]]


            name = Rain Total





Pat

unread,
Jun 9, 2020, 2:57:41 PM6/9/20
to weewx-user
I'm a little confused what you're looking for. Do you want daily totals of rain for all time?

The code below will give you the graph attached.


    [[raindaytotals]]
        title
= Historical Rain Totals By Day
        subtitle
= Rain Totals grouped by Days for All Time

        xAxis_groupby
= day
       
[[[rainTotal]]]
            name
= Rain Total
rainbyday.jpg

Jeff Rabin

unread,
Jun 9, 2020, 4:17:46 PM6/9/20
to weewx-user
I've got several tabs in the graph section.   One is called "Week", which should show the data for the previous seven days.    For the rain section I would like a bar chart that shows the total rain for each day.   Not the historical data, just how must rain was collected for each of the previous seven days.    I have that working fine, see it here:  Week Tab

If you look at it today everything looks fine.     But when the month wraps to the next month, the columns are list in the wrong order.    The columns are sorting on the literal "day", not the month/day.       If it is the 3rd of June, the columns should start with the last few days of May, then the first few days of June.  

Check out my website now.   I've increase the "last week" tab to show 14 days.    You can see the order on the "rain" section starts with the June days, then lists the May days.   Backwards.    It is sorting numerically.    

Screen Shot 2020-06-09 at 4.17.14 PM.png


Jeff Rabin

unread,
Jun 9, 2020, 5:49:43 PM6/9/20
to weewx-user

I just bought you a cup of coffee.  Thanks for the great skin and support!

Pat

unread,
Jun 9, 2020, 6:42:04 PM6/9/20
to weewx-user
Thanks! I've been drinking a lot of it lately with my 2 month old and my 2 year old :) Sleep will get back to normal again, right?

Ok I think I understand now. The time_length of "month" or "week" will begin on the 1st day of the month, or Sunday. You want time_length =  604800 - this is the number of seconds for the last 7 days.  Adjust to however many seconds in the past you want to show. 

The code below will give the result attached

[raintotals]
    title = Rain Totals by Month
    show_button = true
    button_text = Rain Totals
    type = column
    time_length = 604800
    aggregate_type = max
    aggregate_interval = 86400 # 1 day

    [[raindaytotals]]
        title = Historical Rain Totals For The Last 7 Days
        xAxis_groupby = day
        [[[rainTotal]]]
            name = Rain Total
            

rainlast7days.jpg

Pat

unread,
Jun 9, 2020, 6:45:10 PM6/9/20
to weewx-user
Ah, wait, I think I understand even more now. If I set it to 14 days like yours, I get the weird day offset happening. 

It's showing the days in numerical order, not in calendar order (It should be 9, 8, 7, 6, 5, 4, 3, 2, 1, 31, 30, 29, 28, 27, 26)

Let me look into if there's a way to change the sort in graphs.conf



Pat

unread,
Jun 9, 2020, 7:11:55 PM6/9/20
to weewx-user
Seems like it's SQL sorting it as part of the query because of the GROUP BY. Need to research how to make it knock it off. 

Pat

unread,
Jun 9, 2020, 9:14:40 PM6/9/20
to weewx-user
I've got a fix ready; what version of the skin are you using?

On Tuesday, June 9, 2020 at 6:45:10 PM UTC-4 Pat wrote:
rain15days.jpg

Jeff Rabin

unread,
Jun 9, 2020, 9:24:35 PM6/9/20
to weewx...@googlegroups.com
Beta 5

-- 
Jeff Rabin

rain15days.jpg

Jeff Rabin

unread,
Jun 9, 2020, 9:27:14 PM6/9/20
to weewx-user
Actually I’m running b4.    Just put the fix in beta 5 and I’ll update.

Pat

unread,
Jun 9, 2020, 9:29:41 PM6/9/20
to weewx-user
Yep, just pushed the fix to the development branch. Download a fresh copy, install and restart weewx. It should be good after your next archive interval. Let me know

Jeff Rabin

unread,
Jun 9, 2020, 10:16:08 PM6/9/20
to weewx-user
Working great in beta5!   Thanks!
Reply all
Reply to author
Forward
0 new messages