poblabs / weewx-belchertown

A clean and modern weewx skin with real time streaming updates, forecast data and interactive charts. View it in action at BelchertownWeather.com
https://belchertownweather.com
GNU General Public License v3.0
211 stars 112 forks source link

gapsize seems not working on some graphs ? #113

Closed bonjour81 closed 5 years ago

bonjour81 commented 5 years ago

Hello! I played a bit with gapsize, because some of my sensors emits slower than weewx record interval. For example, my rain sensor emits only when some rain worth to be reported (no rain, no emission). My wind sensors emits information regarding battery voltage or solar panel every 10 minutes.

I set gapsize big enough on those graphs, expecting the gaps to be filled. It does works on rain, but does not work on my electrical data, I was not able to figure out why.

Here is my graphs.conf if needed,but I reported the relevant section below. (I renamed graphs.conf to txt so that github allows to upload) graphs.conf.txt

gapsize works fine:

    [[chart3]]
        title = Précipitations
        type = line
        gapsize = 90000000   # 27h
        [[[rainRate]]]
            yAxis = 1
        zindex = 2
            color = black
            lineWidth = 0
            type = line
            [[[[marker]]]]
                enabled = true
            [[[[states]]]]
                [[[[[hover]]]]]
                    lineWidthPlus = 0
        [[[rainTotal]]]
            zindex = 1
            name = Total pluie
        type = area
        #aggregate_interval = 3600
        #aggregate_type = sum
            color = "#14c2f5"

Gapsize seems not working:

    [[chart6]]
        title = Etat batteries
        type = spline
        gapsize = 90000000
        [[[WVbat]]]
            name = Batterie (ane.)
            yaxis_min = 0
            yaxis_max = 8
            #color = "#8d4653"
        [[[Vbat]]]
            name = Batterie (T/H)
            yaxis_min = 0
            yaxis_max = 8
            #color = "#8d4653"
        [[[WVsolar]]]
            yaxis_min = 0
            yaxis_max = 8
            #color = "#7ccf53"
            name = Volt. solaire (Ane.)
        [[[Vsolar]]]
            yaxis_min = 0
            yaxis_max = 8
            #color = "#7ccf53"
            name = Volt. solaire (T/H)
        [[[WIsolar]]]
            name = Courant solaire (Ane.)
        zindex = 2
        #color = "#8085e9"
            yAxis = 1
            yaxis_min = 0
            yaxis_max = 300
            [[[[marker]]]]
                enabled = true
        [[[Isolar]]]
            name = Courant solaire (T/H)
        #zindex = 2
        #color = "#8085e9"
            yAxis = 1
            yaxis_min = 0
            yaxis_max = 300

I added markers in WIsolar so the points are visible.

working: gapsize1 not working (I would expect the small triangle markers to be connected). gapsize2

poblabs commented 5 years ago

Gap size needs to match the interval between your points. Anything outside of that interval will not show.

For example, if you look at the week chart:

[week]
    # Chart Timespan Defaults
   aggregate_interval = 3600 # 1 hour
    gapsize = 3600000

Because the aggregate interval is 1 hour, the gapsize needs to match that same 1 hour (in milliseconds). If a point is more than 1 hour (say 2 hours) apart, then a gap will show indicating that the 1 hour was missed.

If you don't have an aggregate_interval defined, then the gapsize needs to match the expected interval between points. Typically this would be your archive interval from weewx.conf. (defaults to 5 minutes). That's why the default gapsize is gapsize = 300000, 5 minutes in milliseconds.

gapsize is a chart-wide setting. So if Batterie reports every 5 minutes, but Volt. Solaire only reports every 10 minutes, then you will have problems with Volt Solaire because the gapsize is 5 minutes, but that reports every 10 so it will always be in a gap

bonjour81 commented 5 years ago

maybe I misunderstood how gapsize works....but for daily records (homepage graphs), I assume the aggregate internal is the weewx record interval. If gapsize shall match this, how can I "hide" some gaps if a sensor miss one or a few records ?

infact, I'm not sure to understand what is gapsize job if it's same as agreggate interval ?

poblabs commented 5 years ago

Have a look at this ticket and it's history. It may help you understand? https://github.com/poblabs/weewx-belchertown/issues/48

This may also help you: https://api.highcharts.com/highstock/plotOptions.area.gapSize

The job of gapsize is to show a gap if the distance between two plots is greater than the gapsize.

So if the archive interval, or aggregate interval is set to 5 minutes, we set gapsize to 5 minutes since we are expecting a plot every 5 minutes. If the distance between plots is more than 5 minutes, it shows the gap. The gap indicates data was lost.

For example, you suffer a power outage and your station is down for 60 minutes. Then the charts will show the gap to indicate there was no data. Why was there no data? You had a power outage.

poblabs commented 5 years ago

Gap size is chart-wide and not for each sensor. So if you have sensors that report at odd intervals, then you will need to put them onto another chart so that gapsize will work.

bonjour81 commented 5 years ago

Ahhh I think I understood.. it your gapsize same as highcharts gapsize parameter ?

Infact I was thinking it was what is called "connectNulls" in highcharts. if yes, sorry for my confustion !!

poblabs commented 5 years ago

Yep, it's the same as highcharts 😃

bonjour81 commented 5 years ago

I have made a quick reading of #48 (that's a very long discussion! :-) ). it seems both discussions are related. I have to re-read more carefully :)

But ok, I think I misunderstood completely the role of gapsize. What I was looking for is "connectNulls". (https://api.highcharts.com/highcharts/plotOptions.series.connectNulls).

May I suggest to add connectNulls options available for graphs.conf ?

michaelundwd commented 5 years ago

@bonjour81

As the guy who raised #48, let me summarise the discussion for you. What happened previously was that the timescale became non-linear if there was a gap in the readings. Time tick-marks (horizontal axis) would disappear but the curve would be continuous. The changes that Pat made overcame that and inserted a gap in the curve with all the time tick-marks present.

You are right that the two points are related - you want the gap bridged, still retaining the linear time-scale.

HTH

poblabs commented 5 years ago

I just pushed the update for connectNulls. It defaults to false, so you have to specify it to true.

Here's my test. Top chart shows my gapSize. Bottom chart has the same gapSize, but connectNulls is enabled so the line is connected.

image

To add connectNulls, use it at the top of the graph group like:

[day]
    title = Today
    show_button = true
    button_text = Today
    time_length = today
    gapsize = 300000
    connectNulls = true

Please give it a test and close this if you're all set!

olpayras commented 5 years ago

That's a good idea, I tried it on last release 1.0rc8.4, also working if we put connectNulls = true in global charts default. I have to do that because sometimes my weather station doesn't record anything for some hours or minutes on multiple sensors.

poblabs commented 5 years ago

Sorry, connectNulls = true won't be a global default. Thanks for #48 and the work done there, the Highcharts are now in line with weewx's default charts.

The gap is intentional to show missing data such as your sensors not sending data.

If you want to show a line between the missing points, connectNulls is now available!

Take a look at the Seasons skin and how it handles gaps. (this is last 25 hours but the gap is still there)

image

Compared to Highcharts with gapsize. (showing the last 9 hours but with the same gap)

image

poblabs commented 5 years ago

Closing this since connectNulls is working pretty good for me during my tests!

bonjour81 commented 5 years ago

Hi! Sorry, I have been a bit busy, but I made a few tests last hours, all is fine. For example, my sensor sending battery voltage every 10min (so missing some weewx records) is now well displayed on charts. Thank you!