cancel
Showing results for 
Search instead for 
Did you mean: 

automatic graph update python

Valued Contributor
Valued Contributor

Hello,

I am starting to work with APP and therefore with python.

 

Is ist possible to automatic update a graph in the APP API, if any coordinate has changed.

 

I am plotting a set of discrete coordinate which are displayed in the app.

A plotwidget display the curve.

 

Now I would like to see the graph updating if I change any value of the coordinate.

 

Is it possible?

 

Thank you in advance

 

Maxime

Capture.JPG

2 REPLIES

Re: automatic graph update python

Siemens Experimenter Siemens Experimenter
Siemens Experimenter

Dear Maxime,

 

I see you are using "real editors" in your interface.

 

As you can see in the RealEditor help page (just search for RealEditor in the Online help) Real Editors contain a "property" that holds their value.

This is how you can access and modify them:

# to get the property
property = realEditor.getProprety("value")
# and this is how you can set their value
property.setValue("3.14159")

This property is a RealValueProperty for real editors. And it inherits from AbstractProperty. If you go into the AbstractProperty help, you will see that is will generate a signal when its value is changed:

valueChanged(value)

So you can use this signal and connect it to your update function.

realEditor.getProperty("value").valueChanged.connect(updateFunction)

 

You would have to connect all your editors to the updateFunction function when you declare them.

The updateFunction should then go over your editors and update the value of the plot. To update the plot you can either re-create the plot or update the data property of the x and y items of your curve.

 

If you need more help I encourage you to look up the "Plot API App" demo, found under Demos>Platform>Customization>App Designer examples.

 

plotAPI.PNG

 

 

 

 

 

Re: automatic graph update python

Valued Contributor
Valued Contributor

Hello @ElecKid,

Thank you for your feedback.

I got also an explanation from support, which mentions exactly what you explained.

I could fix my issue.

Thank you