Putting two time series graphs into same panel and range for comparing

Hey all, I’m using grafana 8.5.3., and am pretty new to it.

I am trying to compare two different test’s cpu usage values on the same graph, but there x-axis is much different as one test takes place in 2017 and the other in 2020

I tried to use stacking and field overrides to make the x-axis’ start on the same value, but I’ve gotten stuck and confused as to how it works


So, there are two clusters of data which span about 1 minute each


I want that first cluster to start at the same time as my second cluster, so the graph can be zoomed in and the numbers compared easily.

By the way, they don’t NEED to start at the second cluster, I just need to align the graphs to be on top of eachother. If there is a way to change the x axis to something like “data point collected” or something like that, that would work as well. Any help will be greatly appreciated, and if I’m missing something here please ask as I’ll check this post often. Thank you in advance

Welcome

Do you really care the actual test date on your x axis? if so I would give it bogus current date but tack on the time only of the legitimate date. Trying to compare 2 readings separated by 5 years gap is going to cause you some issues.

What is the datasource?

1 Like

hey yosiasz, the actual date doesn’t really matter to me, just the values of cpu. The datasource is influxql!

1 Like

if so, do you want a math value of each 2022/2017 and compare the difference between those 2? What kind of difference do you want to see?

summed up/averaged/math by month? or …

for example avg by month

avg_cpu	metric
43.3601724137931	0715
51.3779166666667	0716
52.4655555555555	0717

I just want to display them “on top” of eachother with no math involved, as if both graphs took place at the “same” time i guess


Just like this graph i made ^^ except I manually added this data to have the same time range! I was hoping there was some way in grafana to override and make my actual datas time ranges kind of fit eachother or put them on top of eachother

gotcha. so in order to do that you will need to fake the dates so that the year of both readings 2022 & 2017 are the same, just the year

This is what I get when doing it using sql server but principle applies for whatever database

but then I create a bucket based on the year and made it stacked. are you using inflxql or flux for query?

I’m using influxql .

please provide sample bucket data

_bucketname,_time,_value,_field,_measurement

Basically at the end your query should return the following pivot

cpu,time,metric
86.3,2022-07-15 13:00:00,2022
93.4,2022-07-15 13:00:00,2017

Hello, I’m new here and am very interested in this topic. I’m intruding into this thread, because of the silimilarity between the OPs desire and my own. But I have no problem with starting a new thread if necessary.
If I understand correctly, acalderon1 wants to align data from different years in just one graph. In my case I want to do the same but for the past X days. I guess the solution would be the same by “faking” the timestamp? Can that be done in grafana? I’m using nodered, influxdb and grafana. Should I have to fake when writing to influxdb, creating another bunch of displaced measurements and increasing database size? Thanks and pardon my intrusion.

1 Like

No faking the timestamp but what is before the timestamp, the date. No need to fake it when pushing it to influxdb, only when querying it.

So it has nothing to do with grafana because it is just a presentation/visualization layer.

Please excuse my ignorance as I have been using grafana for only a week. Can this be done using the GUI options?

1 Like

What do you mean by gui option?

By graphical user interface options I mean simple straight forward configuration methods using check boxes, menu options, parameter boxes, or any other simple way of providing necessary information without having to write in any form of standardized language or convention like c, json, python, etc… Simply put, a manner in which any non-computer-savvy person might find easy and intuitive, like, for instance, my mother.

I don’t think grafana is mom proof. it requires some level of technical expertise.

Take a look at this in case it helps.

https://play.grafana.org/d/000000012/grafana-play-home?orgId=1&editPanel=4

1 Like