XY Chart help, series disappear

I’m trying to make an XY Chart in a perspective view that seems relatively simple but I can’t get it to display properly

I want something that looks like this with a live data series (Blue) and fixed limits (Red & Green)
image
Where the Red and Green series are bound to Memory tags and the Blue series is bound to a tag history.
image
The problem is the Blue series is coming from a tag history and it has polling set up so every time the Blue series updates the Red and Green lines go away. The Red and Green lines are there when the page is loaded but as soon as the Blue series gets updated the red and green go away. Then it looks like this.
image
Am I doing something wrong? Is there a way for all the series to be updated when the tag history is polled?

Thanks

Is there a script that can be called to repaint an XY chart?

I’m still trying to come up with my own solution to make this work…
Thanks to @Phil_B in this thread Perspective XY Chart Datasource Update Question
I am able to successfully display a live chart with a green target line and red limit lines.

However, when I do this the XY chart occasionally crashes. I would appreciate any insight that can help me understand why it’s crashing, thank you.

The way I am currently achieving this is to bind the ‘example’ datasource of the XY chart to an expression, instead of trying to bind directly to a tag history.
The expression binding is

now(5000)  #expression to run every 5 seconds

I then added the transform script…

def transform(self, value, quality, timestamp):
	DataHtag = system.tag.queryTagHistory(paths=["[default]Realistic0"], returnFormat='Wide', columnNames=["t_stamp","Realistic0"],rangeMinutes=10)
	LimitH = []
	Target = []
	LimitL = []
	for row in range(DataHtag.rowCount):
		LimitH.append(27.0)
		Target.append(3.0)
		LimitL.append(-27.0)
	
	DataHtag = system.dataset.addColumn(DataHtag,2,LimitH,"LimitH",float)
	DataHtag = system.dataset.addColumn(DataHtag,3,Target,"Target",float)
	DataHtag = system.dataset.addColumn(DataHtag,4,LimitL,"LimitL",float)
	
	return DataHtag

The ‘[default]Realistic0’ tag is just a generic simulated tag from the gateway.

This transform script pulls 10 minutes worth of data from the tag history into a dataset and then I created 3 arrays full of nothing but the target and limit values and then added those arrays as columns to the dataset.

It works
image
but it occasionally crashes the webpage (Chrome Version 74.0.3729.157). I just have to reload the page to get it to work.
image

When the chart causes the designer to crash I get the following error when trying to close the view.

java.util.concurrent.TimeoutException
at java.base/java.util.concurrent.CompletableFuture.timedGet(Unknown Source)
at java.base/java.util.concurrent.CompletableFuture.get(Unknown Source)
at com.inductiveautomation.perspective.designer.workspace.ViewResourceEditor.getObjectForSave(ViewResourceEditor.java:357)
at com.inductiveautomation.perspective.designer.workspace.ViewResourceEditor.getObjectForSave(ViewResourceEditor.java:59)
at com.inductiveautomation.ignition.designer.tabbedworkspace.ResourceEditor.commit(ResourceEditor.java:160)
at com.inductiveautomation.ignition.designer.tabbedworkspace.TabbedResourceWorkspace.close(TabbedResourceWorkspace.java:255)
at com.inductiveautomation.ignition.designer.tabbedworkspace.TabbedResourceWorkspace.close(TabbedResourceWorkspace.java:242)
at com.inductiveautomation.ignition.designer.tabbedworkspace.TabbedResourceWorkspace$1.actionPerformed(TabbedResourceWorkspace.java:77)
at com.jidesoft.plaf.basic.BasicJideTabbedPaneUI$CloseTabAction.actionPerformed(Unknown Source)
at java.desktop/javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at java.desktop/javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.desktop/java.awt.Component.processMouseEvent(Unknown Source)
at java.desktop/javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.desktop/java.awt.Component.processEvent(Unknown Source)
at java.desktop/java.awt.Container.processEvent(Unknown Source)
at java.desktop/java.awt.Component.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.Window.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.Component.dispatchEvent(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(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
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)

Ignition v8.0.1 (b2019050708)
Java: Azul Systems, Inc. 11.0.2

Hi,

Sorry to hear about your troubles. Can you send me your series configuration so that I can investigate? Also, prior to the crash of the webpage, are you seeing browser memory creep close to 3GB?

-Yousuf

I will say that it tends to crash more often when the script is run more frequently [Now(3000) vs Now(10000)] but it crashes either way. I also tried to reduce the number of data points because the script in the above post has 4 data series consisting of 10 minutes of data which is stored at 3 second intervals so the graph is showing 200 x 4 data points.

I’ve update the script so the red and green limit and target lines only consisted of 2 data points each. I created arrarys full of ‘None’ and only updated the first and last array elements. I’m not sure if that actually reduces the amount of data the graph has to deal with, but I tried. The crashes still occur.

	LimitH = [None]*DataHtag.rowCount
	Target = [None]*DataHtag.rowCount
	LimitL = [None]*DataHtag.rowCount
	
	for row in range(DataHtag.rowCount):
		if (row==0) or (row==DataHtag.rowCount-1):
			LimitH[row]=27.0
			Target[row]=3.0
			LimitL[row]=-27.0

I don’t know the best way to send you the series configuration. But I’ll include some screen shot, if there’s a better way please let me know what you’d prefer
My post from yesterday (5/23) shows the script used to bind the ‘example’ data source. The script is pulling the tag history of the tag ‘Realistic0’. The tag history is being stored in a MS SQL express database.

This is strange too, script returns data set but an error icon is displayed and the chart is diplaying the data

Here’s a screen shot of the series information. Series 0 is the blue data line and Series 1 is the upper red limit.

You mean like this…(I have 16GB of memory)


I also see similar behavior from the designer when it crashes.

The memory usage and CPU% drop back down to normal shortly after crashing

I just created a new project with one view containing an XY Chart with the same settings. I just let it run and crash.
XYChartExample_2019-05-23_1503.zip (16.6 KB)

The race condition seems to have improved. My views with XY charts are not crashing any more.
Updated to 8.0.3-rc1 (b2019072215)

Hi,

That’s interesting. No XYChart updates should be included in RC1, RC2 on the other hand, is where the memory issue should be fixed. So watch for that.

-Yousuf