Problem with Charts and MySql

Hello,

I use the mySQL Binding to store a value every day. This value is already in the database.

Database changed
MariaDB [openhab]> select * from Item1;
±--------------------±------+
| Time | Value |
±--------------------±------+
| 2019-09-06 12:35:00 | 193 |
| 2019-09-06 12:40:00 | 193 |
| 2019-09-06 12:42:00 | 193 |
| 2019-09-06 12:43:00 | 193 |
| 2019-09-06 12:44:00 | 193 |
| 2019-09-06 12:45:00 | 193 |
| 2019-09-07 00:00:00 | 193 |
±--------------------±------+

Then I try to show some of the entries with a chart in my sitemap the following errors are shown in my log.

2019-09-07 10:56:32.700 [WARN ] [thome.ui.internal.chart.ChartServlet] - Chart generation failed: null

2019-09-07 10:56:33.749 [WARN ] [thome.ui.internal.chart.ChartServlet] - Chart generation failed: null

2019-09-07 10:56:33.894 [WARN ] [thome.ui.internal.chart.ChartServlet] - Chart generation failed: null

==> /var/log/openhab2/events.log <==

2019-09-07 10:56:34.158 [ome.event.ItemCommandEvent] - Item ‘Wasserstand_Grafik’ received command 2

2019-09-07 10:56:34.185 [vent.ItemStateChangedEvent] - Wasserstand_Grafik changed from 1 to 2

==> /var/log/openhab2/openhab.log <==

2019-09-07 10:56:34.226 [WARN ] [thome.ui.internal.chart.ChartServlet] - Chart generation failed: null

2019-09-07 10:56:34.527 [WARN ] [thome.ui.internal.chart.ChartServlet] - Chart generation failed: null

2019-09-07 10:56:34.553 [WARN ] [thome.ui.internal.chart.ChartServlet] - Chart generation failed: null

2019-09-07 10:56:34.839 [WARN ] [thome.ui.internal.chart.ChartServlet] - Chart generation failed: null

==> /var/log/openhab2/events.log <==

2019-09-07 10:56:34.982 [ome.event.ItemCommandEvent] - Item ‘Wasserstand_Grafik’ received command 1

2019-09-07 10:56:35.003 [vent.ItemStateChangedEvent] - Wasserstand_Grafik changed from 2 to 1

==> /var/log/openhab2/openhab.log <==

2019-09-07 10:56:35.139 [WARN ] [thome.ui.internal.chart.ChartServlet] - Chart generation failed: null

2019-09-07 10:56:35.394 [WARN ] [thome.ui.internal.chart.ChartServlet] - Chart generation failed: null

This is my coding of my sitemap:

Frame label="Zisterne" {
        Text item=ZTime        label="Zeit" icon="clock" 
        Text item=Depth        label="Abstand zum Wasser in cm"    icon="flow"	
	Text item=Wasserstand  label="Wasserstand in cm"  icon="flow"	
        Switch item=Wasserstand_Grafik label="Zeitraum" icon="clock" mappings=[1="Tag", 2="Woche"]
    	Chart item=Wasserstand service="mysql" period=D refresh=300 visibility=[Wasserstand_Grafik==1, Wasserstand_Grafik=="Uninitialized"]
    	Chart item=Wasserstand service="mysql" period=W refresh=300 visibility=[Wasserstand_Grafik==2]
    }

Any ideas why no value of mysql is shown?

Thanks

According to the docs, the period parameter is before the service.
And the refresh comes first:
Also the refresh is in milliseconds. A chart refresh every 0.3 seconds is not necessary. I think you means 5 minutes which will be 300000ms.
Try:

    	Chart item=Wasserstand refresh=300000 period=D service="mysql" visibility=[Wasserstand_Grafik==1, Wasserstand_Grafik=="Uninitialized"]
    	Chart item=Wasserstand refresh=300000 period=W service="mysql" visibility=[Wasserstand_Grafik==2]

I’ve changed it but it is still the same…

2019-09-07 11:17:46.550 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model ‘my.sitemap’

2019-09-07 11:17:53.110 [WARN ] [thome.ui.internal.chart.ChartServlet] - Chart generation failed: null

==> /var/log/openhab2/events.log <==

2019-09-07 11:17:54.373 [ome.event.ItemCommandEvent] - Item ‘Wasserstand_Grafik’ received command 2

2019-09-07 11:17:54.391 [vent.ItemStateChangedEvent] - Wasserstand_Grafik changed from 1 to 2

==> /var/log/openhab2/openhab.log <==

2019-09-07 11:17:54.922 [WARN ] [thome.ui.internal.chart.ChartServlet] - Chart generation failed: null

==> /var/log/openhab2/events.log <==

2019-09-07 11:17:55.042 [ome.event.ItemCommandEvent] - Item ‘Wasserstand_Grafik’ received command 1

2019-09-07 11:17:55.056 [vent.ItemStateChangedEvent] - Wasserstand_Grafik changed from 2 to 1

Is mySQL the only persistence service installed?

Yes its the only one.

Then remove the service statement:

    	Chart item=Wasserstand refresh=300000 period=D visibility=[Wasserstand_Grafik==1, Wasserstand_Grafik=="Uninitialized"]
    	Chart item=Wasserstand refresh=300000 period=W visibility=[Wasserstand_Grafik==2]

I did so now. Nothing have been changed.

2019-09-07 11:33:22.799 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model ‘my.sitemap’

2019-09-07 11:33:32.224 [WARN ] [thome.ui.internal.chart.ChartServlet] - Chart generation failed: null

==> /var/log/openhab2/events.log <==

2019-09-07 11:33:34.310 [ome.event.ItemCommandEvent] - Item ‘Wasserstand_Grafik’ received command 2

2019-09-07 11:33:34.332 [vent.ItemStateChangedEvent] - Wasserstand_Grafik changed from 1 to 2

==> /var/log/openhab2/openhab.log <==

2019-09-07 11:33:35.205 [WARN ] [thome.ui.internal.chart.ChartServlet] - Chart generation failed: null

==> /var/log/openhab2/events.log <==

2019-09-07 11:33:35.251 [ome.event.ItemCommandEvent] - Item ‘Wasserstand_Grafik’ received command 1

2019-09-07 11:33:35.271 [vent.ItemStateChangedEvent] - Wasserstand_Grafik changed from 2 to 1

==> /var/log/openhab2/openhab.log <==

2019-09-07 11:33:35.789 [WARN ] [thome.ui.internal.chart.ChartServlet] - Chart generation failed: null

Is the persistence service declared as the default service in paperUI?

This is my view in PaperUI

Ok try that:
Remove the visibility options and only keep one chart.

    	Chart item=Wasserstand refresh=300000 period=D //visibility=[Wasserstand_Grafik==1, Wasserstand_Grafik=="Uninitialized"]
    	//Chart item=Wasserstand refresh=300000 period=W visibility=[Wasserstand_Grafik==2]

I’ve changed it to:

Frame label="Zisterne" {
        Text item=ZTime        label="Zeit" icon="clock" 
        Text item=Depth        label="Abstand zum Wasser in cm"    icon="flow"	
	Text item=Wasserstand  label="Wasserstand in cm"  icon="flow"	
        Chart item=Wasserstand refresh=300000 period=D
        }

2019-09-07 11:47:36.988 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model ‘my.sitemap’

==> /var/log/openhab2/events.log <==

2019-09-07 11:47:37.838 [vent.ItemStateChangedEvent] - MD_EF_Motion changed from OFF to ON

==> /var/log/openhab2/openhab.log <==

2019-09-07 11:47:51.989 [WARN ] [thome.ui.internal.chart.ChartServlet] - Chart generation failed: null

==> /var/log/openhab2/events.log <==

2019-09-07 11:47:55.501 [vent.ItemStateChangedEvent] - NTPTime changed from 2019-09-07T11:46:55.467+0200 to 2019-09-07T11:47:55.474+0200

==> /var/log/openhab2/openhab.log <==

2019-09-07 11:47:55.864 [WARN ] [thome.ui.internal.chart.ChartServlet] - Chart generation failed: null

==> /var/log/openhab2/events.log <==

2019-09-07 11:48:08.180 [vent.ItemStateChangedEvent] - MD_EF_Motion changed from ON to OFF

==> /var/log/openhab2/openhab.log <==

2019-09-07 11:48:08.744 [WARN ] [thome.ui.internal.chart.ChartServlet] - Chart generation failed: null

I’ve no idea whats the reason here… do I need something special to display a chart?

One last thing:

        Chart item=Wasserstand period=D refresh=300000

And can you post your .persist file, please?

// persistence strategies have a name and a definition and are referred to in the "Items" section
Strategies {
	// if no strategy is specified for an item entry below, the default list will be used
	everyMinute	: "0 * * * * ?"
	every5Minutes : "0 */5 * * * ?"
   	everyHour   : "0 0 * * * ?"
   	everyDay    : "0 0 0 * * ?"
   	default = everyChange
}

/* 
 * Each line in this section defines for which item(s) which strategy(ies) should be applied.
 * You can list single items, use "*" for all items or "groupitem*" for all members of a group
 * item (excl. the group item itself).
 */

Items {
    // persist all items once a day and on every change and restore them from the db at startup
    Wasserstand : strategy = everyDay, restoreOnStartup
}

nothing happened here

Ok, I am a bit stumped, here
Try increasing the persist frequency to get more data in the database
Restart OH after editing the persist file

I’ll try so… next I’ll be back in 15 minutes with new results

I’ve changed the freq. of my items. This is looking good… every minute an new item in my database.

Database changed
MariaDB [openhab]> select * from Item1;
+---------------------+-------+
| Time                | Value |
+---------------------+-------+
| 2019-09-06 12:35:00 |   193 |
| 2019-09-06 12:40:00 |   193 |
| 2019-09-06 12:42:00 |   193 |
| 2019-09-06 12:43:00 |   193 |
| 2019-09-06 12:44:00 |   193 |
| 2019-09-06 12:45:00 |   193 |
| 2019-09-07 00:00:00 |   193 |
| 2019-09-07 12:00:00 |   193 |
| 2019-09-07 12:04:00 |   193 |
| 2019-09-07 12:05:00 |   193 |
| 2019-09-07 12:06:00 |   193 |
| 2019-09-07 12:07:00 |   193 |
| 2019-09-07 12:08:00 |   193 |
| 2019-09-07 12:09:00 |   193 |
| 2019-09-07 12:10:00 |   193 |
+---------------------+-------+

But still no change on my sitemap. The chart is a white box without anything inside.

Still same log infos…

2019-09-07 12:12:29.378 [WARN ] [thome.ui.internal.chart.ChartServlet] - Chart generation failed: null

2019-09-07 12:12:46.305 [WARN ] [thome.ui.internal.chart.ChartServlet] - Chart generation failed: null

We have seen this error on openhabian installations using rrd4j as the persistence service. You migth want to try This solution. Please report back if it did solve the problem.

Yes!!! The missing fontconfig package was the reason. This will be inside the next stable version of openhab.

Thanks for all the help.