Easy chart not working with SQL Queries for Axes and Subplots


we have many charts displayed in Easy Chart components. In our database we have defined the pens, the axes and the subplots. So we can display a specific chart by just entering SQL queries with the desired plot_id (e.g. 565) for

  • DB Pens: SELECT * FROM GraphPens WHERE plot_id = 565;
  • Axes: SELECT ax.* FROM GraphAxes as ax where ax.name in (SELECT pens.axis FROM GraphPens AS pens inner join GraphPlots AS plots ON pens.plot_id = plots.id where plots.id = 565)
  • Subplots: SELECT * FROM GraphSubplots where plot_id = 565

In the designer it normally works as expected and we get the desired chart. But if we open the page in the client (or open the page in preview mode of the designer) all but the date panel of the chart becomes invisible.
Even when removing the bindings of Axes and Subplots (DB Pens make no problems) the chart does not always come back. What helps is cutting the chart and pasting it. The client (or designer) throw the following exception:

Exception in thread “AWT-EventQueue-0” java.lang.NullPointerException
Exception in thread “AWT-EventQueue-0” java.lang.NullPointerException
at com.inductiveautomation.factorypmi.application.components.chart.PMILineChartPanel.createChart(PMILineChartPanel.java:131)
at com.inductiveautomation.factorypmi.application.components.PMIEasyChart$ChartUpdater.run(PMIEasyChart.java:705)
at com.inductiveautomation.ignition.client.util.EDTUtil$ProcessQueue.run(EDTUtil.java:127)
at java.desktop/java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)

On one of our pages even had the problem that not only did the Easy Chart component disappear but also a Template Repeater that had nothing to do with it. I could even reproduce it by just inserting and removing the SQL query for the subplot while the DB Pens query is still active and Axes has no binding.

What is strange about all that: If we enter the SQL queries for Axes and Subplots in the designer (we always have the Polling Mode set to off), apply it, and then remove the binding, everything works fine. When applying the query we get the desired values from the database and when removing the binding they are still there of course. And then everything is OK. So what is the problem with these SQL bindings?

Has anybody ever had similar experiences or any idea of how to solve that?

Best regards,


Query bindings start up with a null result until the first query result comes in. Most components handle this. Apparently the EasyChart doesn’t. Consider binding to custom properties elsewhere and using a propertyChange event to copy to the target properties (when not null).

Or try checking the ‘Retain Rows’ option of the query binding, so the last queried configuration in the designer is serialized into the window, and the chart doesn’t have to initialize “from scratch” every time the window opens. The tradeoff is that, for however long it takes to run your query(s), the chart will be showing some ‘old’ data. You could save a placeholder ID that doesn’t have any actual data, and make sure to always save the window in the designer with that placeholder ID specified.

Wait! You mean that when retain rows is off the dataset is completely discarded? The model for this was the transient dataset in my DB cache module (also now in Sim Aids), which serializes to a dataset with column definitions but no rows.

Hm, that’s a good point. I believe retain rows should keep column definition (hence the name), so yeah, you’re probably right, it’s something lower level with the binding. Nothing to see here :slight_smile:

Thank you so much for your answers! Checking ‘Retain Rows’ for ‘Axes’ and ‘Subplots’ really did the trick :ok_hand:. For DB Pens it is not necessary.

As the queries only take some ms, showing old data is no problem. But I like that idea. So I put my chart’s ID in a custom property that is set to its zonzero value only after disabling gateway communication in the designer. Thus the chart is empty when saving it.