# Clear chart on new data set

**URL:** <https://discourse.nodered.org/t/clear-chart-on-new-data-set/55544>\
**Category:** Dashboard\
**Created:** [21 December 2021 22:53 UTC](https://discourse.nodered.org/t/clear-chart-on-new-data-set/55544 "2021-12-21T22:53:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hobbes1069](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hobbes1069/32/39892_2.png) [@hobbes1069](https://discourse.nodered.org/u/hobbes1069)\
**Post date:** [21 December 2021 22:53 UTC](https://discourse.nodered.org/t/clear-chart-on-new-data-set/55544/1 "2021-12-21T22:53:32Z")

</div>

I'm using a chart node to show forecasted weather data, so I'm using the timestamps that come with openweathermap. This actually works well, but over time the forecast changes and the chart node tries to chart both the old and new data making it "weird".

How would I go about clearing the chart (sending a blank array) JUST before the new data set?

Here's my current flow:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/d/7df1eb091887ffa718c1500939244111cede4c9d.png)

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [21 December 2021 23:04 UTC](https://discourse.nodered.org/t/clear-chart-on-new-data-set/55544/2 "2021-12-21T23:04:47Z")

</div>

> [@hobbes1069](#):
>
> How would I go about clearing the chart (sending a blank array) JUST before the new data set?

Yes, I would add a trigger node after the mqtt node. Set to output a blank array on first trigger event, linked to your charts. Then send second trigger event to the second output, sending the original msg object to your original flow after a short delay.

---

<div class="post-metadata">

**Author:** ![hobbes1069](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hobbes1069/32/39892_2.png) [@hobbes1069](https://discourse.nodered.org/u/hobbes1069)\
**Post date:** [22 December 2021 13:02 UTC](https://discourse.nodered.org/t/clear-chart-on-new-data-set/55544/3 "2021-12-22T13:02:04Z")

</div>

That works perfectly. Thanks!

While I've mostly gotten the hang of payloads and messages it's still sometime difficult to not think like a procedural program.

---

<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:** [21 January 2022 13:02 UTC](https://discourse.nodered.org/t/clear-chart-on-new-data-set/55544/4 "2022-01-21T13:02:33Z")

</div>

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