Hi,
I am trying to create a heatmap where x axis is time and y axis is a categorical variable (unique ids).
Here is the flux query I use to create the “pivot table”:
// heatmap where
// x axis is datetime (in minute granularity)
// y axis is machine_uid
// values are # of heartbeats received
import "date"
from(bucket: "status")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "status")
|> filter(fn: (r) => r["_value"] == "heartbeat")
|> truncateTimeColumn(unit: 1m)
|> group(columns: ["_time", "machine_uid"], mode:"by")
|> count()
|> group()
|> pivot(rowKey:["_time"], columnKey: ["machine_uid"], valueColumn: "_value")
and this returns a table where columns are machine_uid and the index is _time and values are the count of "heartbeat"s.
table_RESULT
_timeNO GROUPDATETIME:RFC3339
22JRANSUGGF6GK38NO GROUPLONG
LYYVEXLF4DQM1TO4NO GROUPLONG
XDSJ1OHKF4X122UUNO GROUPLONG
0
2022-06-06T18:43:00.000Z
1
0
2022-06-06T18:44:00.000Z
116
0
2022-06-06T21:52:00.000Z
2
0
2022-06-06T21:53:00.000Z
115
0
2022-06-06T22:37:00.000Z
117
However when I want to view this as a heatmap, I can’t seem to choose machine_uid as one of the axis, instead it let’s me choose each single machine.
Is there any way to choose machine_uid as one of the axis?
Thank you @Anaisdg ! Hopefully it will get implemented soon. In the meantime, I was thinking of mapping all machine_uids to some Long value and use it like that.