Perspective PowerChart: how to set default aggregate mode & save user configuration

I have a perspective view containing a PowerChart component. This view is embedded into our custom company web application with an iframe. I have two questions:

  1. When adding a tag to the chart, the aggregate mode is always set to "Default". I am not sure, but I assume the default means "no aggregation". Is there a way to configure the PowerChart so that it always sets "Average" as the preselected aggregate mode?

  2. When navigating in our web application, I can open the powerchart page and add some tags, go to another page and when I come back to the powerchart, the tags are still displayed in the chart. However when I open the same application in a different browser tab, the powerchart is reset to its blank state. Is there a way to configure perspective to save the configuration across tabs?

Hello, anybody? :slight_smile:

Please let me know if these are simply unsupported options currently, so that I can create a Feature Request for them.

1 Like

For your first question, you could use a property change script on the pens prop of the Power Chart.

Something like this perhaps:

if len(self.props.pens) > 0:
	self.props.pens[len(self.props.pens) - 1]['data']['aggregateMode'] = "Average"

For your second question, maybe you could do something with this resource:

If you want your chart config to persist per user across sessions and logins, you'll have to save that config somehow. This resource lets you save trend configs to a database and load them up again. If you modify it a little, you might be able to automatically save the current config on a view's onShutdown and automatically load it on the chart's onStartup etc.


Thanks for replying @Daniel.Snyder, I'll look into those!

Just need to create a Custom property on the Power Chart called 'penCount' to keep track of the current amount for the next Pen(s) add.
Also a script on page load setting the 'penCount' value.
This example is setting the aggregateMode to 'LastValue' on every pen but you can change this to whatever you need.