# Ignition Power Chart, save and restore setup

**URL:** <https://forum.inductiveautomation.com/t/ignition-power-chart-save-and-restore-setup/83028>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [December 12, 2023, 1:33pm UTC](https://forum.inductiveautomation.com/t/ignition-power-chart-save-and-restore-setup/83028 "2023-12-12T13:33:32Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ReyC](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/reyc/32/49461_2.png) [@ReyC](https://forum.inductiveautomation.com/u/ReyC)\
**Post date:** [December 12, 2023, 1:33pm UTC](https://forum.inductiveautomation.com/t/ignition-power-chart-save-and-restore-setup/83028/1 "2023-12-12T13:33:32Z")

</div>

Hello dear colleagues,

This is a question about **Power Chart.** I have a user who does trends display configurations using the browser tag.

But he wants to **keep all his setup** to use them during the next sessions. He also need to be able to switch from on trends setup to another.

Is there a way to **save and restore** Power chart configurations to **files or by another means**?

Else, what is your best or recommended way to comply with my user requirement ?

Thanks  
Cyril

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [December 12, 2023, 1:39pm UTC](https://forum.inductiveautomation.com/t/ignition-power-chart-save-and-restore-setup/83028/2 "2023-12-12T13:39:52Z")

</div>

Check this exchange resource: [Ignition Exchange | Inductive Automation](https://inductiveautomation.com/exchange/92/overview)

It saves the data directly into database tables and then allows retrieval of that data.

Oops... this is Perspective, not Vision.

Try this for inspiration: [Ignition Exchange | Inductive Automation](https://inductiveautomation.com/exchange/2339/overview)

---

<div class="post-metadata">

**Author:** ![Hayden\_Watson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/hayden_watson/32/48792_2.png) [@Hayden\_Watson](https://forum.inductiveautomation.com/u/Hayden_Watson)\
**Post date:** [December 12, 2023, 1:43pm UTC](https://forum.inductiveautomation.com/t/ignition-power-chart-save-and-restore-setup/83028/3 "2023-12-12T13:43:10Z")

</div>

A possible solution is to save the config as a json encoded string into a dataset on a button press.

You could then generate a dropdown that will get values from that dataset.

If you din't want people to see other options, have a column in the dataset with the username, and just show options with matching usernames.

This could also be done with a database and named queries

---

<div class="post-metadata">

**Author:** ![ReyC](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/reyc/32/49461_2.png) [@ReyC](https://forum.inductiveautomation.com/u/ReyC)\
**Post date:** [December 12, 2023, 1:46pm UTC](https://forum.inductiveautomation.com/t/ignition-power-chart-save-and-restore-setup/83028/4 "2023-12-12T13:46:24Z")

</div>

Thanks @Hayden_Watson and @bschroeder

I tray something (dirty) like that, but without success.

Save json pens to customs :  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/c/4c6f7e99199cf6da0e7616a7f299e1e468ed79b5.png)

Button with onclick action :

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/6/e6983426dd2aa7fd8524edb20f878942160d3a4f.png)

Custom mapped to memory tag array. Index according to drop down list.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/2/12d6e0ac6e265d6d59083c70e25ff7c7600125ff.png)

Restore button : from custom liked with memory tag array to power chart :

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/0/a0953fb38c858a581f175b3d94b402e01aacf0e4.png)

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [December 12, 2023, 1:49pm UTC](https://forum.inductiveautomation.com/t/ignition-power-chart-save-and-restore-setup/83028/5 "2023-12-12T13:49:08Z")

</div>

You don't want to save the entire power chart... you want to save the _configuration_ of the power chart.

---

<div class="post-metadata">

**Author:** ![Hayden\_Watson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/hayden_watson/32/48792_2.png) [@Hayden\_Watson](https://forum.inductiveautomation.com/u/Hayden_Watson)\
**Post date:** [December 12, 2023, 1:54pm UTC](https://forum.inductiveautomation.com/t/ignition-power-chart-save-and-restore-setup/83028/6 "2023-12-12T13:54:06Z")

</div>

I would add two buttons and a drop down as a basic example.

A save button would have a script something like:

```auto
dataset = system.tag.readBlocking("Your Dataset Tag Here")[0].value
axes = system.util.jsonEncode(self.getSibling("PowerChart").props.axes)
pens = system.util.jsonEncode(self.getSibling("PowerChart").props.pens)
username = self.session.props.auth.user.userName

dataset = system.dataset.addrow(dataset, ["Option name", axes,pens,username]
system.tag.writeAync("Your Dataset Tag Here",dataset)

```

Have some dropdown with a binding to find the names of your options.

then a restore button with something along the lines of:

```auto
dataset = system.tag.readBlocking("Your Dataset Tag Here")[0].value
for row in range(dataset.getRowCount):
...iterate through dataset to find the saved data....
self.getSibling("PowerChart").props.axes = system.util.jsonDecode(the_axes_value)
self.getSibling("PowerChart").props.pens = system.util.jsonDecode(the_pens_value)

```

You'll need to handle the bindings, some way of entering the name of you new saved option etc. But that should be a start

---

<div class="post-metadata">

**Author:** ![ReyC](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/reyc/32/49461_2.png) [@ReyC](https://forum.inductiveautomation.com/u/ReyC)\
**Post date:** [December 12, 2023, 2:02pm UTC](https://forum.inductiveautomation.com/t/ignition-power-chart-save-and-restore-setup/83028/7 "2023-12-12T14:02:18Z")

</div>

@bschroeder, yes, I would like to save pens part of json tree only  
But, I will try you second link : _Tag Historian Viewer from @erik.forsgren_  
It seems to do what I need exactely.

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/4/3425dd60b40cad25bbebbae567c6227fb5012147.png)

---

<div class="post-metadata">

**Author:** ![ReyC](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/reyc/32/49461_2.png) [@ReyC](https://forum.inductiveautomation.com/u/ReyC)\
**Post date:** [April 19, 2024, 1:40pm UTC](https://forum.inductiveautomation.com/t/ignition-power-chart-save-and-restore-setup/83028/8 "2024-04-19T13:40:33Z")

</div>

I finnaly find a solution with a customized version of :

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

It did not work out of box with sqlite database, but I manage to do it.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/e/bed60d913190347a7a056434edf68e48096b8347.png)
