Belchertown - can the attribute radius be the result of a measurement or the result of maths ?

61 views
Skip to first unread message

Tim Tuck

unread,
Sep 10, 2023, 11:49:09 PM9/10/23
to weewx-user
Hi all,

I've been toying with lightning graphs, in particular this code...

[[chart7]]
        title = Lightning
        [[[lightning_strike_count]]]
            yAxis = 0
            yAxis_min = 0
            yAxis_tickInterval = 1
            yAxis_label = "Number of Strikes"
            stacking = normal
            color = "green"
            lineWidth = 0
            [[[[marker]]]]
                enabled = true
                radius = 4
            [[[[states]]]]
                [[[[[hover]]]]]
                        lineWidthPlus = 0

And I'd like the radius value to equal the lightning strike count and/or
some result of maths depending on that value. e.g. something like this
pseudo code...

if lightning_strike_count =< 10 then radius = lightning_strike_count

if lightning_strike_count => 10 but <= 20 then radius =
lightning_strike_count/10 and color = orange

... etc...

+ other maths to change the colour of the blob from green to orange to
red dependent on how many strikes happen within the reporting time.

So... can chart items like radius and color be the result of computed
values ?

My first few attempts at this have been unsuccessful so I don't know if
this is actually possible.

thanks

Tim



michael.k...@gmx.at

unread,
Sep 11, 2023, 10:35:31 AM9/11/23
to weewx-user
I don't know, if it's possible. If it is possible, I recommend the area being equivalent to the strike count, using a constant factor, if necessary. Something like radius = factor * sqrt(lightning_strike_count/PI)

Tim Tuck

unread,
Sep 11, 2023, 7:42:30 PM9/11/23
to weewx...@googlegroups.com
Hi Michael,

Yes, definitely some maths to produce a radius value that's not going to
blow out the graph for those days when super storms pop 300+ strikes at you!

Even having wild thoughts of intercepting the mqtt stream and having sed
do a substitution directly on the template.

I haven't spent too much time on this as yet, might have to dedicate a
day for investigation.

cheers

Tim


Reply all
Reply to author
Forward
0 new messages