Can't fix time range

Grafana 11.4 on Ubuntu 22.04

Hey folks,
i have a database of playerscore for group of players.
I can visualize them and have very nice results.
But right now we switch our “season” and I would like to preserver the old scores.

There are 2 visualisations, which show the playerscore over 6 months as a time series.
BUT: The current visualisation is focused on 10.24 until now. Thus the second panel is zoomed out of range

Is it possible to fix the “old season” to 04.24 to 09.24, so we have them in comparison?
The second graph should be fixed and never changing again.

Ill add the link below, but will remove it for obvious reasons soon. Its a 1 core VPS. Be nice!!!

Cheers,
Lord

its an http server with the domain of grafanaproblem dot duckdns and add the tld for an organisation :3000 for the port.

Hope it doesnt get banned from posting

Hi,

I don’t think there’s a quick solution for that.

You could try to play around with options in query options:

with there, you can set relative time and time shift to your needs but it still won’t be set in stone, just relative.

Another approach would be to create another dashboard with date picker set for dates from that season and some data link linking the dashboards together - not ideal since you don’t have the data on the same dashboard (unless you embed one dashboard in another which I don’t know if possible).

That would be a hugh PITA, we would not be able to compare the old scores with the new ones.

That is the main idea.
And if I would set the offset to -6 months… we would lose the end score of the last season

What database is used to hold these scores?

How would you do it outside of grafana?
Leave grafana to do what it does best visualization.Do the rest in the datasource by some sQL tricks so as to move the passt into the future

Please share ddl and dml for your data type

MariaDB

I have one for each season.
They are structures like this
±----±-----------±-------±-----------+
| id | player | score | day |
±----±-----------±-------±-----------+
| 2 | Anni | 0 | 2024-11-07 |
| 3 | Anni | -24 | 2024-12-05 |
| 4 | Anni | -24 | 2024-12-12 |
| 5 | Anni | -24 | 2024-12-19 |
| 6 | Anni | -9 | 2025-01-09 |
| 7 | Anni | -9 | 2025-01-16 |
| 8 | Bella | 17 | 2024-11-07 |
| 9 | Bella | -5 | 2024-12-05 |
| 10 | Bella | -5 | 2024-12-12 |
| 11 | Bella | -5 | 2024-12-19 |
| 12 | Bella | -31 | 2025-01-09 |
| 13 | Bella | 48 | 2025-01-16 |
etc…

My query string is
SELECT player AS “metric”, day AS “time”, score FROM doppelkopf.score2425 GROUP BY day, player

1 Like

This is a hobby project and my first contact with grafana.

I dont know what data manipulation language is and whatever the second one means… Sorry.

I calculate the scores of the day, add them to the “last week score” and paste this into my python script to create sql commands, which i paste into my console.

This is not important or sensitive data, so I just bodged everything.

My only goal is to limit the x axis to date1 and date2 as minimum and maximum. That cant be that hard!

1 Like

Maybe you could try a different visualization for that particular panel like XY Chart or Trend which are less/not dependent on the dashboard timerange and should visualize your data from a specific moment in time (it’s all based on your query and what you choose to show on your x- and y-axis).
I guess this isn’t ideal, but maybe still good enough to be used as a workaround?

how do you define old season? stuff in 2024?
again the question still is: how would you do this outside of grafana? in MariaDB query tool?

btw: very helpful for folks that try to help you
DDL: data definition language, tells us what data schema looks like along with column name and data type,

DML: data manipulation language, tells us what the data looks like which you did provide

so there are tricks in some db languages where you can pull past dates metrics into the future but then you need to differentiate them from current date metrics

Now the above is based on the following mock data query it could give you an idea of what I am doing, though some values are static, it is not to be copy pasta’d but to give you a hint on what you could do. again this seems to be not a grafana issue but data source query tricks issue

;with playa
as(
select 2 as id, 'Anni' as player, 0 as score,'2024-11-07' as datetime union
select 3, 'Anni',-24,'2024-12-05' union
select 4, 'Anni',-24,'2024-12-12' union
select 5, 'Anni',-24,'2024-12-19' union
select 6, 'Anni',-9,'2025-01-09' union
select 7, 'Anni',-9,'2025-01-16' union
select 8, 'Bella', 17,'2024-11-07' union
select 9, 'Bella', -5,'2024-12-05' union
select 10, 'Bella', -5,'2024-12-12' union
select 11, 'Bella', -5,'2024-12-19' union
select 12, 'Bella', -31,'2025-01-09' union
select 13, 'Bella', 48,'2025-01-16' 
)
select case year(cast(datetime as datetime)) 
       when 2024 then concat(player, ' 2024') else player end
        as metric, 
       score as value, 
       
       case year(cast(datetime as datetime)) 
       when 2024 then dateadd(yy, 1, cast(datetime as datetime)) else cast(datetime as datetime) end  as [time] 
from playa
order by 3 asc