Display Stacked Series


#1

Hi,
Is there any way to stack different series of data.
Please see attached screenshots.
At the moment, series are displayed next to each other, not on the top of each other.

Thanks


#2

Yes, combine your queries into one query. Use regex for the table name to combine those queries together.

An example:


#3

Hi,
Could you please explain based on my 2 queries because it sounds very complicated to me :frowning:

SELECT sum(“value”) FROM “FRTMAP_TAGS_JC_DEPT_DEI” WHERE $timeFilter GROUP BY “year”, “week”

and

SELECT sum(“value”) FROM “FRTMAP_TAGS_JC_DEPT_DEX” WHERE $timeFilter GROUP BY “year”, “week”

Thanks


#4

Like this I think. This part of the regex (I/X) matches both I and X - the only difference between the two table names.

SELECT sum(“value”) FROM /FRTMAP_TAGS_JC_DEPT_DE(I/X)/ WHERE $timeFilter GROUP BY “year”, “week”


#5

No quite :frowning:

Error:
error parsing query: error parsing regexp: missing closing ): FRTMAP_TAGS_JC_DEPT_DE(I at line 1, char 25


#6

oh sorry - typo:

SELECT sum(“value”) FROM /FRTMAP_TAGS_JC_DEPT_DE(I|X)/ WHERE $timeFilter GROUP BY “year”, “week”

This: (I/X) should be (I|X) The pipe symbol means OR.


#7

Thanks !
SQL works without any errors but graph still not displayed as stacked despite Stack box is ticked :frowning:


#8

You can group by tag - if you have a unique tag value per table?


#9

Sorry, I don’t follow you.
I already Group By Year and month …


#10

You don’t know what tags are? Here are some docs to learn more about InfluxDB:

I just figured it out. You are not using time mode:

image

Stacking does not work in series mode. As you are grouping by time, I’m not sure why you would use series mode?

Also, you can group by time with InfluxDB so don’t think you need to make special tags for year, month. But maybe you have a special case that requires them?


#11

Thanks.
I use year, month and week time because I want to filter by week (Monday to Sunday), month (whole month, not 30 days with InfluxDB…)-… etc.
InfluxDb and Grafana don’t give the flexibility to filter by full month … You can use 30 days … but some months are 30 days, 31 days, 28 and even 29 for February.
By using months and week tags, I can group my data correctly.

This is also why I use the Serie Mode … when the Timefilter is not practical.


#12

If you use Series mode, then stacking will not work unfortunately.


#13

Shame :frowning:
Any plans to make it work ?
Any suggestions how I could achieve this ?
Thanks for your help.


#14

Hi,
Have you find solutions at your problem ?