Hello, all I am trying to find the pattern of the graph, I am not sure
whether it is possible to find the pattern in the graph optainted using InfluxDb. Please do let me know.
I tried but I gave the fixed range. However, that is not correct, what if the pattern is in another range. In addition, possible that the pattern can be seen after time-Interval Again. Here is the graph::
The left is my actual data and on right I gave the fixed range to optain my desired result of pattern . Here is my code:
data = from(bucket: "Fog")
|> range(start: 2021-09-10T06:12:48.546Z, stop: 2021-09-10T06:13:07.531Z)
|> filter(fn: (r) => r["_measurement"] == "SensorInformation")
|> filter(fn: (r) => r["_field"] == "SensorNumber" or r["_field"] == "SensorValue")
|> pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value")
|> filter(fn: (r) => r.SensorNumber == 1 )
|> filter(fn: (r) => r.SensorValue > 0 )
|>group(columns: ["SensorNumber"])
|> max(column: "SensorValue")
|> group()
data1 = from(bucket: "Fog")
|> range(start: 2021-09-10T06:12:48.546Z, stop: 2021-09-10T06:13:07.531Z)
|> filter(fn: (r) => r["_measurement"] == "SensorInformation")
|> filter(fn: (r) => r["_field"] == "SensorNumber" or r["_field"] == "SensorValue")
|> pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value")
|> filter(fn: (r) => r.SensorNumber == 1 )
|> filter(fn: (r) => r.SensorValue > 0 )
|>group(columns: ["SensorNumber"])
|> min(column: "SensorValue")
|> group()
join(
tables: {data:data,data1:data1},
on: ["SensorNumber"], method: "inner"
)
|> map(fn: (r) => ({r with distance: (r.SensorValue_data - r.SensorValue_data1)}))
This is related to this Post : Need to build a query