Power Chart custom pen name powerchart

Hi,

How can I automatically add descriptive names to pens when they are selected from the Browse Tag window?

I read the manual for the Power Chart, but it doesn’t have information about scripting.

https://docs.inductiveautomation.com/display/DOC81/Perspective+-+Power+Chart

If a user selects this particular ‘pv’ to graph, I want the pen name to be set to another tag in the same folder. In this case, the pen name should be set to the value of the ‘Short Name’ tag, which is ‘P-1 Flow’.

pen

I think the second part would involve a Change Script to the pen property to be something like:

self.props.pen[0].name=“The tag that contains the name”

I don’t know how to extract the path to folder that contains ‘pv’ from the Browse Tag window. I think if I have the path, I can append my tag name to it and set the pen name.

This logic would loop through all the pens and set the names accordingly.

Thanks,
Ali

Wait how are you letting the user choose the tag in the client?

With the power chart tool, top left there’s a tag browser button. It’s a bit average for selecting tags though, no filter, and uses a tree view which requires a million clicks.

Better imo to create your own functionality for this with a list component and a text filter. Then you can do whatever you want

1 Like

oh didnt know that existsed xD i thought he was letting the clients on the desinger lol my bad

Can you please provide more details? The user can use the built-in browser to select tags, but I would like to have the chart automatically update the name shown on the chart. I know the names can manually be updated, but it would be cool if this function was automatic.

You could use an on change event on the pens prop to go through each pen and set its label?