# Same dashboard with more relative time panel

**URL:** <https://community.grafana.com/t/same-dashboard-with-more-relative-time-panel/39266>\
**Category:** General\
**Tags:** alerting\
**Created:** [November 14, 2020, 4:57pm UTC](https://community.grafana.com/t/same-dashboard-with-more-relative-time-panel/39266 "2020-11-14T16:57:53Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![donatod](https://avatars.discourse-cdn.com/v4/letter/d/a88e57/32.png) [@donatod](https://community.grafana.com/u/donatod)\
**Post date:** [November 14, 2020, 4:57pm UTC](https://community.grafana.com/t/same-dashboard-with-more-relative-time-panel/39266/1 "2020-11-14T16:57:53Z")

</div>

Hi, I know that probably this has been asked several times but I’m spending several days trying and searching inside the forum without success.  
What I need is display in the same dashboard several panel with data per hour, day and month. I’m able to set it, but only till “now” and starting from 1 “time unit” in the past. What I need is the graphs showing alwasy this x time scale:  
daily: from 00.00.00 to 23:59:59  
monthly: from 01 to last month’s day (28-29-30 or 31)  
yearly: from January to December.  
For data I use mysql and time column is timestamp type.  
Thanks a lot to all

---

<div class="post-metadata">

**Author:** ![pooh](https://avatars.discourse-cdn.com/v4/letter/p/f05b48/32.png) [@pooh](https://community.grafana.com/u/pooh)\
**Post date:** [November 14, 2020, 5:24pm UTC](https://community.grafana.com/t/same-dashboard-with-more-relative-time-panel/39266/2 "2020-11-14T17:24:24Z")

</div>

I’m sorry that I cannot answer your question, but I hope that:

a) there is an answer

b) once we have it, it gets added to the documentation as an example.

This sounds like a very useful facility to me.

Antony.

---

<div class="post-metadata">

**Author:** ![donatod](https://avatars.discourse-cdn.com/v4/letter/d/a88e57/32.png) [@donatod](https://community.grafana.com/u/donatod)\
**Post date:** [November 17, 2020, 6:35pm UTC](https://community.grafana.com/t/same-dashboard-with-more-relative-time-panel/39266/3 "2020-11-17T18:35:10Z")

</div>

I put this question in other forum too, but I got no answer. I don’t believe it is not possible and no one else had and solve this issue

---

<div class="post-metadata">

**Author:** ![donatod](https://avatars.discourse-cdn.com/v4/letter/d/a88e57/32.png) [@donatod](https://community.grafana.com/u/donatod)\
**Post date:** [June 1, 2021, 7:47am UTC](https://community.grafana.com/t/same-dashboard-with-more-relative-time-panel/39266/4 "2021-06-01T07:47:49Z")

</div>

Hi Antony, have you got any solution on this theme?

---

<div class="post-metadata">

**Author:** ![asieroyan](https://avatars.discourse-cdn.com/v4/letter/a/858c86/32.png) [@asieroyan](https://community.grafana.com/u/asieroyan)\
**Post date:** [June 1, 2021, 8:08am UTC](https://community.grafana.com/t/same-dashboard-with-more-relative-time-panel/39266/5 "2021-06-01T08:08:57Z")

</div>

You may need to do a workaround and jump into the code.

First, you will need to create custom graph panels from the original one, and add them in builtin\_plugins.ts in order to activate them in grafana.

Then, in each of them you may go to graph.ts and change addTimeAxis() function in each custom graph for your needs.

Lastly, create a dashboard with each panel being of a different type, but I’m not sure if time units are gonna work well.

This is a tricky solution and it may not be worth trying, but I hope it can help you. Feel free to ask for more info.

---

<div class="post-metadata">

**Author:** ![donatod](https://avatars.discourse-cdn.com/v4/letter/d/a88e57/32.png) [@donatod](https://community.grafana.com/u/donatod)\
**Post date:** [June 1, 2021, 8:11am UTC](https://community.grafana.com/t/same-dashboard-with-more-relative-time-panel/39266/6 "2021-06-01T08:11:29Z")

</div>

Thanks, could you please make a quick example to import?

---

<div class="post-metadata">

**Author:** ![donatod](https://avatars.discourse-cdn.com/v4/letter/d/a88e57/32.png) [@donatod](https://community.grafana.com/u/donatod)\
**Post date:** [June 1, 2021, 9:56am UTC](https://community.grafana.com/t/same-dashboard-with-more-relative-time-panel/39266/7 "2021-06-01T09:56:27Z")

</div>

> [@asieroyan](#):
>
> First, you will need to create custom graph panels from the original one, and add them in builtin\_plugins.ts in order to activate them in grafana.

How can I do that? Pleas could you guide me?  
Thanks a lot

---

<div class="post-metadata">

**Author:** ![asieroyan](https://avatars.discourse-cdn.com/v4/letter/a/858c86/32.png) [@asieroyan](https://community.grafana.com/u/asieroyan)\
**Post date:** [June 1, 2021, 10:12am UTC](https://community.grafana.com/t/same-dashboard-with-more-relative-time-panel/39266/8 "2021-06-01T10:12:00Z")

</div>

You need to copy the graph panel folder to another folder in the same scope with another name.

Then, go to public \> app \> features \> plugins \> built\_in\_plugins.ts and add your panel the same way the other ones are added, just copy anything the graph panel is in on the next line and change “graph” for your custom name.

Then, take a look at the imports on your new panel’s imports and make sure they all point to the newly created graph and its classes, and not to the old one.

Now you will have a new panel in grafana which you can manipulate and works just like the graph panel.

---

<div class="post-metadata">

**Author:** ![donatod](https://avatars.discourse-cdn.com/v4/letter/d/a88e57/32.png) [@donatod](https://community.grafana.com/u/donatod)\
**Post date:** [June 1, 2021, 2:21pm UTC](https://community.grafana.com/t/same-dashboard-with-more-relative-time-panel/39266/9 "2021-06-01T14:21:45Z")

</div>

Ok. I copied …\grafana\public\app\plugins\panel\graph as …\grafana\public\app\plugins\panel\Test\_graph and in built\_in\_plugins.ts I added these line after the original “graph” ones:

import \* as Test\_graphPanel from ‘app/plugins/panel/Test\_graph/module’;  
‘app/plugins/panel/Test\_graph/module’: Test\_graphPanel,

I restarted grafana but I still see only the original one! ☹  
I’m starting from a completely new and empty dashboard

---

<div class="post-metadata">

**Author:** ![asieroyan](https://avatars.discourse-cdn.com/v4/letter/a/858c86/32.png) [@asieroyan](https://community.grafana.com/u/asieroyan)\
**Post date:** [June 2, 2021, 11:17am UTC](https://community.grafana.com/t/same-dashboard-with-more-relative-time-panel/39266/10 "2021-06-02T11:17:15Z")

</div>

Make sure you change the class exports name in the new graph’s module.ts and graph.ts (beware with the imports you will need to change for that). In your case, GraphCtrl will be changed to Test\_graphCtrl and GraphElement → Test\_graphElement

---

<div class="post-metadata">

**Author:** ![donatod](https://avatars.discourse-cdn.com/v4/letter/d/a88e57/32.png) [@donatod](https://community.grafana.com/u/donatod)\
**Post date:** [June 2, 2021, 3:20pm UTC](https://community.grafana.com/t/same-dashboard-with-more-relative-time-panel/39266/11 "2021-06-02T15:20:02Z")

</div>

Thanks, I missed it.  
In the meantime I was able to accomplish what I needed.  
For the relative time I set “0s” in all the panels, and as time shift “0d/d”, “0M/M”, “0y/y” depending on what I wanted to display.  
Now I have the last problem: In a panel I want to show all the result from the beginning till now, grouped by year (I use Mysql).  
It’s strange the result I get, even without setting anything as relative time:

 ![image](https://us1.discourse-cdn.com/grafana/original/3X/0/6/06455704e2e871cf89ec7dce84a0915f83ea9e2e.png)  
As you can see I have these as last value for each year:  
2019-12-20 01:00:00 with 50908 and 2020-12-19 01:00:00 with 54066  
 ![image](https://us1.discourse-cdn.com/grafana/original/3X/b/0/b09af06edf74172272d319fdd394b439dd0533b3.png)  
 ![image](https://us1.discourse-cdn.com/grafana/original/3X/4/6/466ae3777ef4febfa54dd24d7c8207332b7b1a94.png)  
But I have no data for the 2019, and several data till now in 2021. This is my table, from the beginning till now (a row per each hour):

```auto
        Timing | Avg | Yearly
2020-12-04 17:00:00 | 3.98 | 47804.2
..............
2020-12-19 00:00:00 | 3.75 | 50908.3
2020-12-19 01:00:00 | 5.24 | 50918.4
..............
2020-12-31 23:00:00 | 3.3 | 54065.9
2021-01-01 00:00:00 | 3.25 | 2.3
..........
2021-06-02 13:00:00 | 4.32 | 32178.5
2021-06-02 15:00:00 | 4.6 | 32489.5

```

This is what I should have, plotted from the same DB with this instruction:  
SELECT AVG(Avg), MAX(Yearly), YEAR(Timing) AS Year FROM historic GROUP BY YEAR(Timing) ORDER BY Timing

```auto
Avg | Yearly | Year
4.50 | 54065.9 | 2020
4.32 | 32489.5 | 2021

```

![image](https://us1.discourse-cdn.com/grafana/original/3X/0/7/07f1e1071349b9b2a359e0905d35b72a8c212c1a.png)
