Manipulate props of an object on another view

Could someone help me changing a PowerChart's props that is in another view?

Screen 1 -> Has 10 buttons and each one represents a tag. Those 10 buttons open the same pop up (screen 2)
Screen 2 -> Just has a PowerChart inside it, and I need to show on graph only those that I've clicked on.

Ex: Click button 1 (PowerChart's content (tag1)), Click button 3 (PowerChart's (tag1 and tag3)) and then sucessively

I've already tried to use message to run a script to append the axis and pen that I need, but when I close the PopUp it seems to deletes the previous axis and pen that I appended, idk.

You don't want to do this (specifically code screen 1 to know about the contents of screen 2). It's an antipattern that's inherently fragile (what if you decide to add another container to screen 2, or change the name of a component, or whatever?).

Send a message from screen 1 that just indicates which tag was selected.
Have a message handler on screen 2 that listens for the "a tag was selected" message. In that message handler, (or, by invoking a custom script on your chart) do your axis manipulation.

That way you've "separated concerns" - the list of buttons is only in charge of dictating which tag was selected. The chart is in charge of reacting to a tag being selected.


I was doing the following sequence:

  • Button -> Open pop up -> Send the message with a payload that contais just the tag that I want to add;
  • In the PowerChart's screen, I'm using the root the message handler.
  • The root uses that tag on a script to it add correctly on the graph. But, it just add after I click again on the button behind the pop up. On the first click it just open the pop-up with no information on the graph.

ps: If I add it using the double click that I mentioned before, close the pop-up and open again with a normal button, all the changes that the double click made is deleted.

Hope it was clear :cold_sweat:

That's because you're sending a message before the handler is listening.
For the first tag, pass it as a parameter to the popup and add it from there.

You can send a message from the on change script of parameters, but a simple binding should be enough - the powerchart data shouldn't be reset if the parameter doesn't change, which should not happen. You may want to wait for confirmation on that.

1 Like

I started to use this on change script as you suggested, it's working. But I don't want to reset the powerchart data, is there a way to do it?

After searching about it I got the idea to create it on session custom prop and link it

Then the popup don't reset its data when I close it.

Thanks you all for the support.