Custom html gauge query

I’m successfully able to show a custom html table using a time series query.
It’s currently returning several rows.

If I switch the time series query to a gauge query (keeping the same name of the query), shouldn’t that return one row of data? (code for header and body stays the same).
I get nothing, and can’t figure out what’s wrong.

Shouldn’t it return the same “time” and “value” object?

The Time Series query returns an array of objects while the Gauge query returns just one object without an array. So data type is different. If your custom code is expecting an array instead of an object the behavior will be different.
Ref: https://docs.losant.com/dashboards/custom-html/

You can see a sample input passed to the block with both a time series and a gauge query:

{
  "size": {
    "width": 309.883,
    "height": 290
  },
  "dashboard": {
    "theme": "light",
    "time": 1585396295437
  },
  "ctx": {
    "dashboardUrl": "https://app.losant.com/dashboards/xxxxxxxxxxxxx"
  },
  "queries": {
    "gauge-0": {
      "time": "2020-03-25T11:02:30.000Z",
      "value": 17365.7
    },
    "time-series-0": [
      {
        "time": "2020-03-14T11:00:00.000Z",
        "value": 16218.800000000001
      },
      {
        "time": "2020-03-14T12:00:00.000Z",
        "value": 16225.1
      },
      {
        "time": "2020-03-14T13:00:00.000Z",
        "value": 16231.5
      },
      {
        "time": "2020-03-14T14:00:00.000Z",
        "value": 16238
      },
    ]
  }
}
1 Like