# Dashboard backup

**URL:** <https://discourse.nodered.org/t/dashboard-backup/25303>\
**Category:** Dashboard\
**Created:** [22 April 2020 12:55 UTC](https://discourse.nodered.org/t/dashboard-backup/25303 "2020-04-22T12:55:25Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![corin.corvus](https://avatars.discourse-cdn.com/v4/letter/c/7feea3/32.png) [@corin.corvus](https://discourse.nodered.org/u/corin.corvus)\
**Post date:** [22 April 2020 12:55 UTC](https://discourse.nodered.org/t/dashboard-backup/25303/1 "2020-04-22T12:55:26Z")

</div>

Hi,

is it possible to save dashboard data (for example chart data) for restart node-red service? At the moment i lost all Data.  
At the Moment i use node-red-dashboard

Thank you

Alex

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [22 April 2020 13:17 UTC](https://discourse.nodered.org/t/dashboard-backup/25303/2 "2020-04-22T13:17:38Z")

</div>

hmm what does the info box for the chart node say ?

---

<div class="post-metadata">

**Author:** ![corin.corvus](https://avatars.discourse-cdn.com/v4/letter/c/7feea3/32.png) [@corin.corvus](https://discourse.nodered.org/u/corin.corvus)\
**Post date:** [22 April 2020 13:33 UTC](https://discourse.nodered.org/t/dashboard-backup/25303/3 "2020-04-22T13:33:20Z")

</div>

"The node output contains an array of the chart state that can be persisted if needed. This can be passed into the chart node to re-display the persisted data."

But i dont know how i can do this.

Full Text:

> Plots the input values on a chart. This can either be a time based line chart, a bar chart (vertical or horizontal), or a pie chart.
> 
> Each input `msg.payload` value will be converted to a number. If the conversion fails, the message is ignored.
> 
> Minimum and Maximum **Y** axis values are optional. The graph will auto-scale to any values received.
> 
> Multiple series can be shown on the same chart by using a different `msg.topic` value on each input message. Multiple bars of the same series can be shown by using the `msg.label` property.
> 
> The **X** axis defines a time window or a maximum number of points to display. Older data will be automatically removed from the graph. The axis labels can be formatted using a [Moment.js time formatted](https://momentjs.com/docs/#/displaying/format/) string.
> 
> Inputting a `msg.payload` containing a blank array `[]` will clear the chart.
> 
> See **[this information](https://github.com/node-red/node-red-dashboard/blob/master/Charts.md)** for how to pre-format data to be passed in as a complete chart.
> 
> The **Blank label** field can be used to display some text before any valid data is received.
> 
> The label can also be set by a message property by setting the field to the name of the property, for example `{{msg.topic}}` .
> 
> The node output contains an array of the chart state that can be persisted if needed. This can be passed into the chart node to re-display the persisted data.

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [22 April 2020 14:19 UTC](https://discourse.nodered.org/t/dashboard-backup/25303/4 "2020-04-22T14:19:21Z")

</div>

First of all, you need to create a file based context store, see [https://nodered.org/docs/user-guide/context](https://nodered.org/docs/user-guide/context) which is a means to save your chart data to your SD/hard disk so the data will survive a reboot.

Once you've done that, add a change node on the output of your chart node, and set it to save the output to flow.context

And finally, add a inject node to the input of the same chart node, set to inject once on startup, and inject the flow.context back into the chart node, which will restore the chart to how it was before the reboot.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [22 April 2020 14:28 UTC](https://discourse.nodered.org/t/dashboard-backup/25303/5 "2020-04-22T14:28:52Z")

</div>

There is an example in the flows site that purports to do exactly what you want  
[https://flows.nodered.org/flow/92920b4fd450bf92a3035e061947daa0](https://flows.nodered.org/flow/92920b4fd450bf92a3035e061947daa0)

---

<div class="post-metadata">

**Author:** ![corin.corvus](https://avatars.discourse-cdn.com/v4/letter/c/7feea3/32.png) [@corin.corvus](https://discourse.nodered.org/u/corin.corvus)\
**Post date:** [22 April 2020 14:33 UTC](https://discourse.nodered.org/t/dashboard-backup/25303/6 "2020-04-22T14:33:51Z")

</div>

Ok i will test it today.  
Thank you

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [22 April 2020 14:38 UTC](https://discourse.nodered.org/t/dashboard-backup/25303/7 "2020-04-22T14:38:07Z")

</div>

> [@Colin](#):
>
> There is an example in the flows site that purports to do exactly what you want

Isn't that an old example - pre context data?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [22 April 2020 14:45 UTC](https://discourse.nodered.org/t/dashboard-backup/25303/8 "2020-04-22T14:45:59Z")

</div>

> [@Paul-Reed](#):
>
> Isn't that an old example - pre context data?

Yes, but it still works. Probably the author should update it, I don't suppose he is very busy at the moment. 🙂

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [22 April 2020 14:47 UTC](https://discourse.nodered.org/t/dashboard-backup/25303/9 "2020-04-22T14:47:19Z")

</div>

~~@corin.corvus give me 5 minutes and I'll do you an example flow...~~

Set up your file based context store first as per the link above, then see this flow -

```auto
[{"id":"8bc18a0c.193898","type":"ui_chart","z":"c53060.842a0fa","name":"","group":"61d2dced.3db8f4","order":1,"width":0,"height":0,"label":"chart","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":350,"y":670,"wires":[["764ce7e5.7d6fe8"]]},{"id":"764ce7e5.7d6fe8","type":"change","z":"c53060.842a0fa","name":"","rules":[{"t":"set","p":"mydata","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":500,"y":670,"wires":[[]]},{"id":"2d5661a2.898ebe","type":"inject","z":"c53060.842a0fa","name":"","topic":"","payload":"mydata","payloadType":"flow","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":350,"y":630,"wires":[["8bc18a0c.193898"]]},{"id":"61d2dced.3db8f4","type":"ui_group","z":0,"name":"flowtest","tab":"3c94630c.13381c","order":1,"disp":true,"width":22,"collapse":false},{"id":"3c94630c.13381c","type":"ui_tab","z":0,"name":"Test","icon":"dashboard","order":9}]

```

---

<div class="post-metadata">

**Author:** ![corin.corvus](https://avatars.discourse-cdn.com/v4/letter/c/7feea3/32.png) [@corin.corvus](https://discourse.nodered.org/u/corin.corvus)\
**Post date:** [22 April 2020 15:10 UTC](https://discourse.nodered.org/t/dashboard-backup/25303/10 "2020-04-22T15:10:37Z")

</div>

Hi,  
now i think i did it.  
i have a context folder in .node-red with a file.

now i impored your flow. may i connect all charts with one change node or i have to add a change node for each chart?

ok i tested it with one chart. after restart the data was dropped.

i set this in settings.js:

> ```
> contextStorage: {
> default: {
> module:"localfilesystem"
> },
> },
> 
> ```

But i can see the data in "contextdata" in webgui but without data before restart.

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [22 April 2020 15:16 UTC](https://discourse.nodered.org/t/dashboard-backup/25303/11 "2020-04-22T15:16:55Z")

</div>

> [@corin.corvus](#):
>
> may i connect all charts with one change node or i have to add a change node for each chart?

You need to have a different store for each chart, otherwise all of your charts will display the same data.

Example -  
flow.temperature  
flow.windspeed  
flow.humidity

Did you reboot after setting up the context store to make it available?  
Can you try again.

---

<div class="post-metadata">

**Author:** ![corin.corvus](https://avatars.discourse-cdn.com/v4/letter/c/7feea3/32.png) [@corin.corvus](https://discourse.nodered.org/u/corin.corvus)\
**Post date:** [22 April 2020 15:20 UTC](https://discourse.nodered.org/t/dashboard-backup/25303/12 "2020-04-22T15:20:46Z")

</div>

is this ok?

 ![2020-04-22 17_19_08-Node-RED _ 10.0.0.171](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/e/8e61ec9f6ced4bfa4fccb2be1d3ca39ec15cbee3.jpeg)

data are in

 ![2020-04-22 17_19_48-Node-RED _ 10.0.0.171](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/4/74afcdee650bf1265049fc3c57f33859bfa028c6.jpeg)

can i "service nodered restart"?

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [22 April 2020 15:25 UTC](https://discourse.nodered.org/t/dashboard-backup/25303/13 "2020-04-22T15:25:11Z")

</div>

That looks ok, however I can't see the inject node feeding into the chart node, I'll assume it's off-screen.  
You need to inject the saved data back into the chart when it restarts (just like my example flow)

Can you stop/start again.

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [22 April 2020 15:29 UTC](https://discourse.nodered.org/t/dashboard-backup/25303/14 "2020-04-22T15:29:52Z")

</div>

![save](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/b/7b6e9712916aa0c5ec3a9a2076b83227933989c9.jpeg)

---

<div class="post-metadata">

**Author:** ![corin.corvus](https://avatars.discourse-cdn.com/v4/letter/c/7feea3/32.png) [@corin.corvus](https://discourse.nodered.org/u/corin.corvus)\
**Post date:** [22 April 2020 16:37 UTC](https://discourse.nodered.org/t/dashboard-backup/25303/15 "2020-04-22T16:37:18Z")

</div>

the test works fine!  
 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/f/4fed3ae2f0c293018a9f991f1f78bd78b4785efe.png)

do i need both for each chart ? do i need click on all before i restart or only one time forever?

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [22 April 2020 17:38 UTC](https://discourse.nodered.org/t/dashboard-backup/25303/16 "2020-04-22T17:38:46Z")

</div>

> [@corin.corvus](#):
>
> do i need both for each chart ?

Yes, a change node to save the chart data, and a inject node to restore the chart data.

> [@corin.corvus](#):
>
> do i need click on all before i restart or only one time forever?

You don't need to click the inject node at all. It will inject the data automatically after a reboot/restart because the 'Inject once...' box is ticked.

![inject](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/d/bdfeb16e14d61b29c841e0c85fc0e65e4809f3ce.jpeg)

It will look after itself with no interaction necessary.

---

<div class="post-metadata">

**Author:** ![corin.corvus](https://avatars.discourse-cdn.com/v4/letter/c/7feea3/32.png) [@corin.corvus](https://discourse.nodered.org/u/corin.corvus)\
**Post date:** [22 April 2020 17:52 UTC](https://discourse.nodered.org/t/dashboard-backup/25303/17 "2020-04-22T17:52:52Z")

</div>

Ah ok.

its done. Thank you 🙂

 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/1/a1a92e1c98b33aeaa05821bbbae9020abd34a634.png)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [6 May 2020 17:53 UTC](https://discourse.nodered.org/t/dashboard-backup/25303/18 "2020-05-06T17:53:02Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
