Displaying Fruits Array Data in Time Series Tooltip on Hover
Hello Grafana community,
I’m working on a time-series visualization to track fruits in different baskets over time and need help with tooltip display. Let me break down my current implementation and the challenge I’m facing.
Sample of data is
ts fruits_count fruits_list Basket_name
07-10-2024 00:00 0 Baske-1
07-10-2024 00:00 1 [“Apple”] Basket-2
07-10-2024 00:00 1 [“Mango”] Baske-2
07-10-2024 00:00 0 Basket-3
07-10-2024 00:05 1 [“Apple”] Baske-3
07-10-2024 00:10 2 [“Banana”, “Orange”] Basket-4
07-10-2024 00:15 1 [“Orange”] Baske-4
07-10-2024 00:20 0 Baske-1
07-10-2024 00:25 1 [“Strawberry”] Baske-5
07-10-2024 00:30 1 [“Apple”] Baske-2
07-10-2024 00:35 0 Basket-2
Data Structure & Query Explanation:
SELECT
ts as time,
Basket_name,
CAST(fruits_count AS INTEGER) as value,
fruits_list
FROM demo.fruit_queues_v2
WHERE Basket_name IN ($basket)
ORDER BY ts
Why this query structure:
• ts as time: Essential for time-series plotting
• CAST(fruits_count AS INTEGER): Ensures proper numeric handling for metrics
• fruits_list: Array field containing actual fruit names in each basket
• WHERE Basket_name IN ($basket): Allows dynamic basket selection through variables
• ORDER BY ts: Ensures proper temporal sequencing
Transformation Pipeline Explanation:
- Rename Fields:
o Rename value to fruit_count to provide better semantic clarity for metrics display. - Group By:
o Group: time, Basket_name
o Aggregations: lastNotNull for fruit_count and fruit_list - Partition By Values:
o Field: Basket_name
o Naming: “as label”
o Keep Fields: Yes
Override Configurations & Their Purpose:
- For fruit_count:
Fields matching: fruit_count (lastNotNull) (EX[A-Z]±\d+)
Display name: ${__field.labels.basket_name}
Hide in area: Yes - For fruit_list:
Fields matching: fruit_list (lastNotNull) (EX[A-Z]±\d+)
Display name: $fruit_list
Hide in area: Yes
Current Tooltip Issue:
When hovering, I only see:
Basket-3 1
Desired Tooltip Display:
Basket_name Basket-4
fruits_list [“Banana”, “Orange”]
fruits_count 2
Questions:
-
With Time Series visualization and my current setup:
o Is there a specific transformation needed for array field display?
o Should I modify the override pattern for fruits_list?
o Are there alternative approaches to make array data visible in tooltips? -
Given that this is a time series visualization:
o Are there known limitations with array field display in tooltips?
o Would custom tooltip formatting help?
I’ve tried to maintain the time series aspect while making the array data accessible. Any guidance on achieving this while keeping the current visualization type would be greatly appreciated!