Graph multiple devices in time series graph automatically

time-series

#1

Is there a way to plot multiple series in the graph automatically by selecting an attribute that is common among all devices and having a new series per device, or do I have to add each series manually with a different device ID selected per series?


#2

Though what you’re asking for is how the GPS History block works (providing a tag, and all devices matching that tag get individually displayed in the block), this is not how the Time Series block works. You will have to set up a different series for each line on the graph.

This is because aggregating GPS attributes is not really possible, whereas taking the average (or minimum, or maximum, etc.) value of a number of devices’ specified attribute and graphing it is a much more common use case.


#3

Thanks for the reply. What I want to do is to plot each device as a different series in the time series block, plotting attributes that are common between all devices (i.e. signal strength or voltage). I want to be able to add devices without adding new series to the block manually but I guess that would be the workaround for now.

So voltage vs time with multiple series by deviceId and rssi vs time with multiple series by deviceId is the idea.


#4

I am looking for this feature too, has this been implemented since?


#5

Hey @Leroy_Lim,

Currently, you can’t do this. We do have many mechanisms to use one visualization for multiple devices. But, this doesn’t include segments on a Time Series Graph. I think the main reason here is if that was dynamic and you had 100 devices, placing 100 lines on the graph wouldn’t be very readable.

There may be some alternatives I can recommend here. If you give me some background to what you want to show, maybe I can suggest a better way?


#6

I have managed to achieve it with a workaround with the use of Vega-lite, Dashboard context variable, experience workflow, Time Series Query, and a raw function.

My use case was to only show devices managed by an experience user. Hence, I do not know the specific device to be shown in each series in the time series graph.

I am unable to upload the workflow here as I’m a new user but the vega-lite is as follows:

{
  "$schema": "https://vega.github.io/schema/vega-lite/v3.json",
  "description": "Example description",
   "autosize": {
    "type": "fit",
    "contains": "padding"
  },
  "data": {"url": "https:// < url > .onlosant.com/devices-data?division={{ctx.division.value}}"},
  "mark": "line",
  "encoding": {
    "x": {"field": "time", "type": "temporal"},
    "y": {"field": "value", 
          "type": "quantitative", 
          "axis": {"title": " < title > "}},
    "color": {"field": "name", "type": "nominal", "title":"Devices"}
  }
}

#7

@Leroy_Lim Nice!

The only thing I would add that could be useful for you is cache busting. You can see more about it here:

https://docs.losant.com/dashboards/custom-chart/#vega-configuration

In your URL you can add: &t={{block.time}}

https://<url>onlosant.com/devices-data?division={{ctx.division.value}}&t={{block.time}}

#8

Great! Thanks! Added that in