How to plot multiple time series with the same time on the same graph?

Hi,

I have seen a video on https://www.youtube.com/watch?v=I3o3tnj5j6s&feature=emb_logo, in which at 11:53 you can see the graph:

I have a dataset with columns:
datetime,
modem,
tap_id,
tap_val.

For example:

dtime              |modem|tap_nr|tap_val|
-------------------|-----|------|-------|
2020-04-02 12:00:00|M1   |tap01 |      3|
2020-04-02 12:00:00|M1   |tap02 |      2|
2020-04-02 12:00:00|M1   |tap03 |     10|
2020-04-02 12:00:00|M1   |tap04 |      5|
2020-04-02 12:00:00|M1   |tap05 |      8|
2020-04-02 12:00:00|M1   |tap06 |      6|
2020-04-02 12:00:00|M1   |tap07 |     10|
2020-04-02 12:00:00|M1   |tap08 |      4|
2020-04-02 12:00:00|M1   |tap09 |      3|
2020-04-02 12:00:00|M1   |tap10 |      6|
2020-04-02 12:00:00|M2   |tap01 |      4|
2020-04-02 12:00:00|M2   |tap02 |      3|
2020-04-02 12:00:00|M2   |tap03 |     11|
2020-04-02 12:00:00|M2   |tap04 |      6|
2020-04-02 12:00:00|M2   |tap05 |      9|
2020-04-02 12:00:00|M2   |tap06 |      7|
2020-04-02 12:00:00|M2   |tap07 |     11|
2020-04-02 12:00:00|M2   |tap08 |      5|
2020-04-02 12:00:00|M2   |tap09 |      4|
2020-04-02 12:00:00|M2   |tap10 |      7|
2020-04-02 12:30:00|M1   |tap01 |      1|
2020-04-02 12:30:00|M1   |tap02 |      3|
2020-04-02 12:30:00|M1   |tap03 |      6|
2020-04-02 12:30:00|M1   |tap04 |      4|
2020-04-02 12:30:00|M1   |tap05 |      9|
2020-04-02 12:30:00|M1   |tap06 |      2|
2020-04-02 12:30:00|M1   |tap07 |     10|
2020-04-02 12:30:00|M1   |tap08 |      5|
2020-04-02 12:30:00|M1   |tap09 |      6|
2020-04-02 12:30:00|M1   |tap10 |      3|
2020-04-02 12:30:00|M2   |tap01 |      7|
2020-04-02 12:30:00|M2   |tap02 |      3|
2020-04-02 12:30:00|M2   |tap03 |      4|
2020-04-02 12:30:00|M2   |tap04 |      3|
2020-04-02 12:30:00|M2   |tap05 |      4|
2020-04-02 12:30:00|M2   |tap06 |      5|
2020-04-02 12:30:00|M2   |tap07 |      8|
2020-04-02 12:30:00|M2   |tap08 |      4|
2020-04-02 12:30:00|M2   |tap09 |      1|
2020-04-02 12:30:00|M2   |tap10 |     10|

Basically, we are monitoring modems through time, and log (every 30 min) their taps (tap = switch) positions (single modem usually have more taps and one tap can have position in range of integers).

Idea is to show line graph for certain 30 min for all modems in barchart or linechart format.
I have created such charts as toy example in python and plotly for barchart:

or linechart:

Can I somehow do this in Grafana?
According to the video from the beginning of this post, it is possible, but I don’t know how?

Can someone please help?

Regards.

Unless I misunderstand the issue all you need to do is to create a query for each line.

I don’t know in advance how many lines I will have.
It depends on variable selection and filtering.
I cannot hardcode the queries.

1 Like

In that case perhaps it would be a good idea to rephrase the thread title and the question.
Perhaps it is clear from the video but very few are going to be bothered to watch a video.
My suggestion answers all the requirements of the thread title and the written text as far as I can see.

Well, from the whole video, only the picture I have put here is important.
As English is not my first language, I really don’t know how to rephrase the question.
If you have an idea, please tell, I will change it.

You answer is correct but it is not feasible to me because number of queries is dynamic. I don’t know in advance how many queries it will be.

Regards.

The missing bit is the use of the word dynamic. The graph shown from the video can be accomplished just by specifying the queries, unless you need the queries generated dynamically.

Yes, graph on the picture has 12 groups, so 12 queries would be OK.
In my case I have (at the moment) cca 300 groups, and that number vary (in the future it will be larger).

You can use variables to parameterise queries to select which data you want to see, but I presume you have already investigated that.

This thread is already old, but in case someone else is struggling with similar problem, here’s my 5 cents.
If I understood the question correctly, I have managed to achieve something similar this way:
In the query settings:

  1. Remove the filtering condition (where modem=M1)
  2. Add “Group by”: tag(modem)
  3. Define the “Alias by” as: [[tag_modem]]
  4. Remove other queries as you do not need to have separate queries for each modem anymore

And the translation:

  1. get data for all modems instead
  2. grouping by a tag will create separate graphs for each value of the tag
  3. in the legend of each group the name of the group is clumsy by default. This setting will make it look better (please try with and without this setting and you will notice the difference).
1 Like