# Dashboard: Change X-Axis in graph with button or slider

**URL:** <https://discourse.nodered.org/t/dashboard-change-x-axis-in-graph-with-button-or-slider/14864>\
**Category:** Dashboard\
**Created:** [28 August 2019 18:08 UTC](https://discourse.nodered.org/t/dashboard-change-x-axis-in-graph-with-button-or-slider/14864 "2019-08-28T18:08:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![HeyJonny](https://avatars.discourse-cdn.com/v4/letter/h/35a633/32.png) [@HeyJonny](https://discourse.nodered.org/u/HeyJonny)\
**Post date:** [28 August 2019 18:08 UTC](https://discourse.nodered.org/t/dashboard-change-x-axis-in-graph-with-button-or-slider/14864/1 "2019-08-28T18:08:14Z")

</div>

Hey everybody!

I have a rather simple question, but I'm trying for 2 days to solve my issue and found nothing, which would help me. So that's my problem:  
I have a chart and I want to adjust the X-Axis (Timestamps) using buttons like "last 5 minutes", "last 10 minutes", and so on. As far as I have understood, I have to inject a msg into the chart, containing an ui\_control as described in [https://github.com/node-red/node-red-dashboard/blob/master/config-fields.md](https://github.com/node-red/node-red-dashboard/blob/master/config-fields.md)  
Now my problem: I have absolutely no idea how to get the message into the chart. At the moment it looks something like this:

 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/7/773a1859ad55f8f3dcac60c645608f035a609377.png)  
So how to connect the button with the chart? Could someone give me a small tutorial? After 2 days of googeling I still don't get, what to do!  
Many thanks for helping!!

---

<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:** [28 August 2019 18:23 UTC](https://discourse.nodered.org/t/dashboard-change-x-axis-in-graph-with-button-or-slider/14864/2 "2019-08-28T18:23:43Z")

</div>

Take a look at [this post & video tutorial.](https://discourse.nodered.org/t/solar-powered-weather-station/12499/25)  
I've tried it and it worked really well! (although I'm currently using Grafana instead)

---

<div class="post-metadata">

**Author:** ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)\
**Post date:** [28 August 2019 19:11 UTC](https://discourse.nodered.org/t/dashboard-change-x-axis-in-graph-with-button-or-slider/14864/3 "2019-08-28T19:11:28Z")

</div>

Here is the topic about nearly similar case. Get the basics from it and replace text inputs with buttons and you are probably achieved your goal [Chart Variable Timeline X-Axis](https://discourse.nodered.org/t/chart-variable-timeline-x-axis/13945)

---

<div class="post-metadata">

**Author:** ![HeyJonny](https://avatars.discourse-cdn.com/v4/letter/h/35a633/32.png) [@HeyJonny](https://discourse.nodered.org/u/HeyJonny)\
**Post date:** [28 August 2019 19:54 UTC](https://discourse.nodered.org/t/dashboard-change-x-axis-in-graph-with-button-or-slider/14864/4 "2019-08-28T19:54:27Z")

</div>

Works!! Many, many thanks!! I'm happy 🙂

---

<div class="post-metadata">

**Author:** ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)\
**Post date:** [28 August 2019 19:57 UTC](https://discourse.nodered.org/t/dashboard-change-x-axis-in-graph-with-button-or-slider/14864/5 "2019-08-28T19:57:03Z")

</div>

Wonderful 😉
