Pass tag history path to easy chart popup

Good morning,

in the pages of my project I have some process variables (usually float number) and all of them are historicized into the database. I would like to know if should be possible to create a “standard” easy chart popup where, if I click on the process variable, I open the easy chart popup and I pass the history tag path of that specific process variable. All the other settings of the trend will be always the same (colors, axes ecc).

I guess I could make it adding a custom property where I write the tag path history in every process variable and pass it to the Tag Pens dataset, but I really can’t figure out how to start all this.

Thanks for the help!

Yes, this is practical. You would create your popup window with the pre-configured EasyChart (anchored to all four edges, perhaps) with its tagPens property bound to a tagPens custom dataset property of the root container. That will let your pass any arbitrary list of tagPens to your popup as window parameters.

Then, on the source object, add a custom dataset property that will hold that object’s tagPen dataset (one row). No binding, just set it up with the right columns. Easily done in the designer by getting the actual chart to display the desired pen, the copying the tagPens dataset to the clipboard. Then paste into the source object’s custom dataset. On the source object, you can script opening the window, passing the source object’s static dataset as a parameter. Or, if the source object has an indirect binding, you can use a cell update binding in the source to keep its one-row dataset pointing at the right tag path.

For maximum flexibility, you can create root container datasets for all of the chart’s configuration.

Good morning pturmel, thanks for your help, I’ve done what you suggest and everything works fine!

I have only one “problem” about the opening of the popup; the template that I use for showing the process variable is composed by three row, PV, SP and output, but if I have to show only the PV I have a template property where I set 1, 2 or 3 row and I show only the number of the row I need and I just hide the others.

What happen is that if I set 1 row (the PV), if I click on the 2 hidden rows the mouseclicked event works anyway. So the operator press in a empty place of the page but the popup trend is opened anyway. I upload a screenshot to show the problem.

How could I manage this problem in your opinion?

Annotation 2021-12-03 203336

The same information that hides or displays the extra rows should be checked in an if statement in the script that launches the popup.

I try to add the if statement but actually is not working.
I mean if I have set NumberOfRows = 1 I show only the first row (the PV), but if I change the script in this way

if event.source.NumberOfRows == 1:

	window = system.nav.openWindow('General/PopupSingleTrend)
	system.nav.centerWindow(window)

if I click on the hidden third row for example the if statement is true even if the row is not showed and the mouse clicked event works.

I don’t know if I’m explaining correctly :sweat_smile:

It sounds like you’ve put the popup-launching click event on the container? I’d put it on the numeric display in the template. Presumably the numeric display knows if it is visible, and knows its own tagpath.

Yes is exactly as you say, is in the template. I just put the script in the mouse clicked event of the numeric display in the template as you suggest and everything works perfectly.

Thanks for the support and have a nice day!

pturmen, I would like to ask if you can help me to understand a tricky thing that happens in the template.

As I said I have the template where if I show all the three rows (PV, SP and out), when I click on the template in the mouse clicked event I have to open a popup trend where I show a lot of pens; in this case the popup is dedicated to that specific loop regolation with lot of pens and the script is very simple

window = system.nav.openWindow(' specific popup trend path')
system.nav.centerWindow(window)

I have also the case where I have only the PV row as we talk in the old messages and in this case I open a generic popup where I pass the tag path.

To avoid to open the generic popup if I don’t want or don’t need to like the example done above, I add a boolean variable in the template called “EnableOpenPopup” and I manage the mouse clicked event script of the numberic label of the PV like this

if event.source.parent.parent.EnableOpenPopup:

	window = system.nav.openWindow('generic popup trend path')
	system.nav.centerWindow(window)
	
	system.gui.getWindow("'generic popup trend path").rootContainer.TagPens_Dataset = event.source.parent.parent.TagPens_Dataset
	system.gui.getWindow("'generic popup trend path").rootContainer.ChartTitle = event.source.parent.parent.MouseoverTxt

So if I have to open the specific popup trend I just add the script manually on the mouse clicked event of the template present in the page, instead if I have only one row and I have to open the generic popup trend I enable the EnableOpenPopup so the script in the template works opening the generic popup.

Everything works great if I have only the PV row, instead if I have all the three row and I have to open the specific popup trend, if I click on the numeric label of the PV nothing happen ( the popup opens if I click in all the other places of the template, but not where on the numeric label where I put the “internal” script).
It looks like that the “internale” script of the template (the one where I check if I have the EnableOpenPopup bit), have the priority on the script of the mouse clicked script of the template in the page.

Sorry for the explanation, I know I’m not been very clear, I hope you can understand what I mean.

Yes, what you’ve described is expected. In Java Swing (which is the basis of Ignition’s Vision client), mouse and other input events are consumed by the innermost component that has an event listener set up for that kind of event. Having an event that does nothing still consumes the event. You will need to put intelligent scripts on all three rows in your template, and have them handle all possible cases.

Ok I understand, thanks for the explanation. Now that I know that is not a my error I will try to figure out how to manage it. Maybe I could add a string custom property where I could insert the path of the specific popup I would like to open.

I’ll think about it, thanks again for all your help, have a nice day.

1 Like

Hi Aiasa21,
I am also trying to do same. made one popup window with easy chart and a main window to call the popup by mouse clicked event and setting Pass Parameters with custom properties. but not got success in passing Value on Easy chart to show graph. It would be nice if you could share some pics of steps to configure this. I am also using same custom properties in popup window.