I’m working with charts. The acquired data return three measures for each reading.
This is a sample of some of these.
[
{
"m_devID": 1,
"m_time": "2022-04-04T13:48:11.000Z",
"temperature": "17.65",
"cond": "2900",
"hum": "4.36"
},
{
"m_devID": 1,
"m_time": "2022-04-04T14:08:11.000Z",
"temperature": "17.59",
"cond": "2900",
"hum": "4.36"
},
{
"m_devID": 1,
"m_time": "2022-04-04T14:28:11.000Z",
"temperature": "17.54",
"cond": "2900",
"hum": "4.36"
}
]
I transform the data in order to be used with chart, to di so I’ve implemented one for cycle and I build what I need.
These data are the transformed ones.
[
{
"series": [
"Temp °c",
"Hum. %",
"Cond mS/cm"
],
"data": [
[
{
"x": 1649080091000,
"y": 17.65
},
{
"x": 1649081291000,
"y": 17.59
},
{
"x": 1649082491000,
"y": 17.54
}
],
[
{
"x": 1649080091000,
"y": 4.36
},
{
"x": 1649081291000,
"y": 4.36
},
{
"x": 1649082491000,
"y": 4.36
}
],
[
{
"x": 1649080091000,
"y": 2.9
},
{
"x": 1649081291000,
"y": 2.9
},
{
"x": 1649082491000,
"y": 2.9
}
]
],
"labels": [
"ltemp",
"lhum",
"lcond"
]
}
]
I’m convinced that is possible to do the same whit a simpler JSONATA operation, but I wasn’t able to find one. I’m wrong, does exist a simple JSONATA transform?
F.