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

**URL:** <https://forum.inductiveautomation.com/t/perspective-powerchart-how-to-set-default-aggregate-mode-save-user-configuration/72513>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [April 17, 2023, 8:50am UTC](https://forum.inductiveautomation.com/t/perspective-powerchart-how-to-set-default-aggregate-mode-save-user-configuration/72513 "2023-04-17T08:50:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Frosty](https://avatars.discourse-cdn.com/v4/letter/f/f475e1/32.png) [@Frosty](https://forum.inductiveautomation.com/u/Frosty)\
**Post date:** [April 17, 2023, 8:50am UTC](https://forum.inductiveautomation.com/t/perspective-powerchart-how-to-set-default-aggregate-mode-save-user-configuration/72513/1 "2023-04-17T08:50:51Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Frosty](https://avatars.discourse-cdn.com/v4/letter/f/f475e1/32.png) [@Frosty](https://forum.inductiveautomation.com/u/Frosty)\
**Post date:** [April 24, 2023, 9:05am UTC](https://forum.inductiveautomation.com/t/perspective-powerchart-how-to-set-default-aggregate-mode-save-user-configuration/72513/2 "2023-04-24T09:05:40Z")

</div>

Hello, anybody? 🙂

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

---

<div class="post-metadata">

**Author:** ![djs](https://avatars.discourse-cdn.com/v4/letter/d/e47774/32.png) [@djs](https://forum.inductiveautomation.com/u/djs)\
**Post date:** [April 24, 2023, 12:56pm UTC](https://forum.inductiveautomation.com/t/perspective-powerchart-how-to-set-default-aggregate-mode-save-user-configuration/72513/3 "2023-04-24T12:56:56Z")

</div>

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

Something like this perhaps:

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

```

---

<div class="post-metadata">

**Author:** ![djs](https://avatars.discourse-cdn.com/v4/letter/d/e47774/32.png) [@djs](https://forum.inductiveautomation.com/u/djs)\
**Post date:** [April 24, 2023, 1:05pm UTC](https://forum.inductiveautomation.com/t/perspective-powerchart-how-to-set-default-aggregate-mode-save-user-configuration/72513/4 "2023-04-24T13:05:11Z")

</div>

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

> **[Ignition Exchange](https://www.inductiveautomation.com/exchange/46/overview)**
>
> Discover, share, and download community made Ignition resources in collaboration with your organization or the Ignition community.

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.

---

<div class="post-metadata">

**Author:** ![Frosty](https://avatars.discourse-cdn.com/v4/letter/f/f475e1/32.png) [@Frosty](https://forum.inductiveautomation.com/u/Frosty)\
**Post date:** [April 24, 2023, 1:48pm UTC](https://forum.inductiveautomation.com/t/perspective-powerchart-how-to-set-default-aggregate-mode-save-user-configuration/72513/5 "2023-04-24T13:48:01Z")

</div>

Thanks for replying @djs, I'll look into those!

---

<div class="post-metadata">

**Author:** ![Jeff\_Sizemore](https://avatars.discourse-cdn.com/v4/letter/j/a587f6/32.png) [@Jeff\_Sizemore](https://forum.inductiveautomation.com/u/Jeff_Sizemore)\
**Post date:** [August 30, 2023, 9:26pm UTC](https://forum.inductiveautomation.com/t/perspective-powerchart-how-to-set-default-aggregate-mode-save-user-configuration/72513/6 "2023-08-30T21:26:57Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/c/dc4e8116ef0cf9131ef60dc366081cee18756d1c.png)

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.
