Graphing one attribute as a function of another

@Lars_Andersson,

I believe I see your issue now, the problem lies in the fact that defining the time series query only allows for association of a single attribute to that query. When in actuality what you want is at each time point, give me the pressure and flow as the x,y coordinates and plot that.

So I’ve dug into a bit into past Losant forum posts actually and I believe I’ve found a solution. You need to use the Vega-Lite Lookup Transform feature. Vega also provides quite a few scatter plot examples.

I was curious on how this might look in Losant and spun up a very basic example. I simulated a device for pressure and flow values, and then configured a custom chart block which you can see below. I’ve also attached what I’ve set my config to.

Please let me know if this helps steer you in the right direction. You’ll likely need to play around with the duration and resolution values in the query set up to get to exactly what you’re looking for.

Thanks,
@Aidan_Zebertavage

{ "width": {{block.width}},
"height": {{block.height}},
"autosize": {
"type": "fit",
"contains": "padding"
 },
"data": {
"name": "flow"
},
"transform": [
{
  "lookup": "time",
  "from": {
    "data": {
      "name": "pressure"
    },
    "key": "time",
    "fields": [
      "value"
    ]
  },
  "as": [
    "data_02_new_name"
  ]
}
],
"layer": [
   {
  "mark": "point",
  "encoding": {
    "x": {
      "field": "value",
      "title": "flow",
      "type": "quantitative"
    },
    "y": {
      "field": "data_02_new_name",
      "title": "pressure",
      "type": "quantitative"
    }
  }
  }
]
}