Hello
I’m running on Grafana 12.4.3 and I’m trying to overlap a XY trend from a timeseries with another curve that could be considered as a reference which doesn’t come from a timeserie because it won’t change overtime. Here are my tables
Table 1: event_time, speed, hotel
Table 2: speed, hotel
The table 1 is populated by sensors every 30 secondes, and I’ll want to see all value within $__timeFilter
Here is the basic request i have for Table 1 :
SELECT
vtg_speed,hotel, $__time(event_time)
FROM
Table_1
WHERE
$__timeFilter(event_time)
And here is the basic request I have for table 2:
SELECT
vtg_speed,hotel_load
FROM
Table_2
And here is the result with XY Chart for table 1 and Trend for Table_2
I was not able to find a solution to show both on them on the same visualization. When I do both queries within the same visualization I am not able to use any variable from the first querie to setup the XY fields.
If you have any idea, thank you very much for your help.
Yes use one XY Chart panel with two queries and manual series mapping. You do not need to join the tables or use a second visualization.
Use:
Query A → sensor/time-series data
SELECT
event_time,
vtg_speed,
hotel
FROM table_1
WHERE $__timeFilter(event_time)
ORDER BY event_time;
Query B → static reference curve
SELECT
vtg_speed,
hotel_load
FROM table_2
ORDER BY vtg_speed;
Then go to XY Chart → Series mapping → Manual.
Configure:
Series 1
- Frame:
Series (A)
- X field:
vtg_speed
- Y field:
hotel
Series 2
- Frame:
Series (B)
- X field:
vtg_speed
- Y field:
hotel_load
This gives you both curves in the same XY Chart →
- Query A: sensor
vtg_speed → hotel, restricted by $__timeFilter
- Query B: static
vtg_speed → hotel_load, unaffected by the dashboard time range
The important part is selecting the Frame for each series. The X/Y fields are then selected from that frame, so Query B’s vtg_speed can be used as the X field for the reference curve.
AWESOME !
Clear explanation and well illustrated, Thank you very much !
I got exactly what I need !