Boostrap and LiveCharts ...

85 views
Skip to first unread message

Yves Martin

unread,
Jul 18, 2023, 9:19:57 AM7/18/23
to weewx-user
Hi,

2 questions:

1. How to add a scale on the right side of the chart if 2 charts are mixed in one picture?

Here is the code:

    [[radiation]]
        [[[radiation]]]
            payload_key = radiation
            #convertFunction = "function(value) { return value / 126.7; }" #you can do value conversions if needed
            showMaxMarkPoint = true
            showMinMarkPoint = true
            showAvgMarkLine = true
            lineColor = '#ffcd56'
            decimals = 0
        [[[UV]]]
            yAxisIndex = 1  #to assign UV to the 2nd yAxis
            aggregateType = avg
            aggregateInterval = 3600
            payload_key = UV
            showMaxMarkPoint = true
            showMinMarkPoint = true
            showAvgMarkLine = false
            lineColor = '#7f1ae555'
            decimals = 0

My issue is, I cannot see the UV chart because I cannot add a correct scale on the right side of the chart.

2. How to add the Air Quality charts on the LiveChart:

    [[pm2_5_aqi]]
        [[[pm2_5_aqi]]]
            payload_key = outAQI
            showMaxMarkPoint = true
            showMinMarkPoint = true
            showAvgMarkLine = false
            lineColor = '#428bca'
            decimals = 0
        [[[pm2_5]]]
            payload_key = outAQI
            showMaxMarkPoint = true
            showMinMarkPoint = true
            showAvgMarkLine = false
            lineColor = '#428bca'
            decimals = 0

but I get an error like the variable is not set :

Jul 18 09:05:56 weewx4-raspi weewx[31203] ERROR weewx.reportengine: Caught unrecoverable exception in generator 'user.jsonengine.JSONGenerator'
Jul 18 09:05:56 weewx4-raspi weewx[31203] ERROR weewx.reportengine:         ****  'pm2_5_aqi'
Jul 18 09:05:56 weewx4-raspi weewx[31203] ERROR weewx.reportengine:         ****  Traceback (most recent call last):
Jul 18 09:05:56 weewx4-raspi weewx[31203] ERROR weewx.reportengine:         ****    File "/usr/share/weewx/weewx/reportengine.py", line 197, in run
Jul 18 09:05:56 weewx4-raspi weewx[31203] ERROR weewx.reportengine:         ****      obj.start()
Jul 18 09:05:56 weewx4-raspi weewx[31203] ERROR weewx.reportengine:         ****    File "/usr/share/weewx/weewx/reportengine.py", line 385, in start
Jul 18 09:05:56 weewx4-raspi weewx[31203] ERROR weewx.reportengine:         ****      self.run()
Jul 18 09:05:56 weewx4-raspi weewx[31203] ERROR weewx.reportengine:         ****    File "/usr/share/weewx/user/jsonengine.py", line 51, in run
Jul 18 09:05:56 weewx4-raspi weewx[31203] ERROR weewx.reportengine:         ****      self.gen_data()
Jul 18 09:05:56 weewx4-raspi weewx[31203] ERROR weewx.reportengine:         ****    File "/usr/share/weewx/user/jsonengine.py", line 128, in gen_data
Jul 18 09:05:56 weewx4-raspi weewx[31203] ERROR weewx.reportengine:         ****      ret, category_history = self.gen_history_data(category, data_type, live_options, self.c$
Jul 18 09:05:56 weewx4-raspi weewx[31203] ERROR weewx.reportengine:         ****    File "/usr/share/weewx/user/jsonengine.py", line 210, in gen_history_data
Jul 18 09:05:56 weewx4-raspi weewx[31203] ERROR weewx.reportengine:         ****      db_value_tuple = weewx.units.as_value_tuple(rec, column_name)
Jul 18 09:05:56 weewx4-raspi weewx[31203] ERROR weewx.reportengine:         ****    File "/usr/share/weewx/weewx/units.py", line 1644, in as_value_tuple
Jul 18 09:05:56 weewx4-raspi weewx[31203] ERROR weewx.reportengine:         ****      val = record_dict[obs_type]
Jul 18 09:05:56 weewx4-raspi weewx[31203] ERROR weewx.reportengine:         ****  KeyError: 'pm2_5_aqi'
Jul 18 09:05:56 weewx4-raspi weewx[31203] ERROR weewx.reportengine:         ****  Generator terminated

Yves,
YMartin.com/meteo

michael.k...@gmx.at

unread,
Jul 18, 2023, 9:29:09 AM7/18/23
to weewx-user
If you check the documentation in the skin.conf:


"choose weewx field name" 

So [[[pm2_5_aqi]]] is invalid, since you don't have a column in your archive table named "pm2_5_aqi"

You probably (just a guess) tried to configure something like that:

 [[outAqi]]
        [[[pm1_0]]]

            showMaxMarkPoint = true
            showMinMarkPoint = true
            showAvgMarkLine = false
            lineColor = '#b44242'
            decimals = 0
        [[[pm2_5]]]

            showMaxMarkPoint = true
            showMinMarkPoint = true
            showAvgMarkLine = false
            lineColor = '#428bca'
            decimals = 0
        [[[pm10_0]]]

            showMaxMarkPoint = true
            showMinMarkPoint = true
            showAvgMarkLine = false
            lineColor = '#7f1ae5'
            decimals = 0

michael.k...@gmx.at

unread,
Jul 18, 2023, 9:40:08 AM7/18/23
to weewx-user
For the UV-Chart, something like this should work:

    [[radiation]]
        [[[radiation]]]
            payload_key = radiation
            showMaxMarkPoint = true
            showMinMarkPoint = false
            showAvgMarkLine = false

            lineColor = '#ffcd56'
            decimals = 0
        [[[UV]]]
            yAxisIndex = 1
            plotType = bar

            aggregateType = avg
            aggregateInterval = 3600
            payload_key = UV
            showMaxMarkPoint = false
            showMinMarkPoint = false

            showAvgMarkLine = false
            lineColor = '#7f1ae555'
            decimals = 0

Yves Martin

unread,
Jul 18, 2023, 9:57:15 AM7/18/23
to weewx-user
Hi Michael,

Thank you.
It does not work, probably because I'm still with bootstrap 4.0.

About table named "pm2_5_aqi", I do not understand how the other charts are generated if it is not in the db?

I've added "pm2_5_aqi" and it works.

About the documentation, I do not have all the info, but I will check what to send previously about the variables and tags we can add in the Livechart.

I put all in pause for now and I will try it again tonight.

Thank you

Yves,
YMartin.com/meteo

michael.k...@gmx.at

unread,
Jul 18, 2023, 10:35:59 AM7/18/23
to weewx-user
> It does not work, probably because I'm still with bootstrap 4.0. 
Still, or again? You switched in the mean time. The real problem is: you are demanding instructions and suggestions, then you are getting these instructions and sugguesstion, then you are doing something totally different and after that you are complaining, that things don't work. Simple as that.

> I've added "pm2_5_aqi" and it works.

But why did you?

Every series you have defined in a chart that works, has a database column with it's exact name. Period.
[[pm2_5_aqi]] # <=== valid, if not existing as column name in the archive table
        [[[pm2_5_aqi]]] 
 # <=== INVALID, if not existing as column name in the archive table

            payload_key = outAQI
            showMaxMarkPoint = true
            showMinMarkPoint = true
            showAvgMarkLine = false
            lineColor = '#428bca'
            decimals = 0
        [[[pm2_5]]] # <=== valid, if existing as column name in the archive table

            payload_key = outAQI
            showMaxMarkPoint = true
            showMinMarkPoint = true
            showAvgMarkLine = false
            lineColor = '#428bca'
            decimals = 0


Yves Martin

unread,
Jul 18, 2023, 5:09:57 PM7/18/23
to weewx-user
Michael,

My goal is still the same for 6 months, to replace/update my old version of weewx and Boostrap (including various addons), which has not been updated for 5-6 years (approximately) and to be able to integrate my air quality sensor and keep my actual database (weewx.sdb) of course! To do this, I had no choice but to reinstall weewx with a more recent Debian distribution and the Python language. This has NEVER change.

I've tried to installed Bootsrap 4.1 with your help twice but get lot of errors and issues. Because your distribution is not finished (that I've explained before) I will use the version 4.0 till the official version (4.1) will be released by you. Again, I did not change my mind about it, so please be patient with me. I test, I try and ask help and do my best with my knowledge, and I am very happy to share my experiences with this group of course!

Actually, my web site (YMartin.com/meteo) is working @ 90%. There are some options I will wait for, as the tags to add different blocs of texts in different languages in the html templates, the options on the LiveCharts, etc.

I really like what you did with the bootstrap.

(...)

Is it possible to have different index with different scales (like the UV and radiation on my main page) one on the left and another one on the right with bootstrap 4.0 or should I wait for 4.1 ?

About the "pm2_5_aqi" added in the database, I'm now able to show it in the livecharts. That is why I've added it in the db. In another hand, I will keep the data in the db!

Yves,
YMartin.com/meteo

michael.k...@gmx.at

unread,
Jul 18, 2023, 11:30:34 PM7/18/23
to weewx-user
>  I've tried to installed Bootsrap 4.1 with your help twice but get lot of errors and issues. Because your distribution is not finished (that I've explained before) I will use the version 4.0 till the official version (4.1) will be released by you. Again, I did not change my mind about it

No, this is not true. You installation dos not work, because you are not reading the docs, not following instructions, ignoring suggestions. It does not work, because you try to achieve things with 4.0, which are not supported before 4.1. This is nothing to make a mind about, it is a fact. And that's something I've told you already, multiple times.

> Is it possible to have different index with different scales (like the UV and radiation on my main page)

Yes. With 4.1. Install it. 

> Actually, my web site (YMartin.com/meteo) is working @ 90%

It would have been 100% (except for not supported featuers) days ago, if you had:

- Posted relevant logs, when you have bin asked for it
- Read the instructions (interestingly, although not very exhaustive documented, almost all of you questions could have been solved with the existing docs)
- Followed the instructions you were given
- Followed the suggestions you were told

>  About the "pm2_5_aqi" added in the database, I'm now able to show it in the livecharts. 

You shouldn't have. You should have used pm2_5. If the sensor/driver has another name for it, map it. 

>  I really like what you did with the bootstrap.

Appreciated. But I don't like what you are doing here.

> I am very happy to share my experiences with this group of course!

Then let's hope the opposite is also true.

Yves Martin

unread,
Jul 18, 2023, 11:51:09 PM7/18/23
to weewx-user
Michael,

You look like a very susceptible person. What you says is not true.
you look at your life point and ignore those of others.
Yes I try things. You have no documentation (or not very much) so the only way is asking and try...

I don't want to argue with you.
I give-up for now.

YM

michael.k...@gmx.at

unread,
Jul 19, 2023, 1:25:53 AM7/19/23
to weewx-user
Your posts and my posts, linking to sources of existing documentation for almost every of your questions prove you wrong. 
There is no argument. Just facts.


Reply all
Reply to author
Forward
0 new messages