Skip to main content

Dashboard Panels

Concepts:

  1. Panel Type: There are multiple available panel kinds that you can choose from on Golain. Each panel comes with its own customizabilities.

  2. Panel Definition: This is where we store the panel specific properties to render the panel in a specific manner as configured by the user. The APIs do not enforce any structure to this JSON object, it can be anything that the frontend stores and reads from.

  3. Panel Data Config: We fetch data for panels using our own Dynamic Query Builder. This is a JSON object with a specific syntax using which you can write absolutely any kind of SQL Query to fetch data from your data-points!

    This is a sample Data Config:

    {
    "select": [
    {
    "agg": "avg",
    "alias": "cupsBrewed",
    "param": "cupsBrewed"
    },
    {
    "alias": "bucket",
    "expression": {
    "values": {
    "timeBucket": "1 days"
    },
    "pattern": "time_bucket('{timeBucket}', timestamp)"
    }
    }
    ],
    "group": ["bucket", "device_id"],
    "where": [
    {
    "timestamp": {
    "lte": "2024-01-03T12:41:48.114Z"
    }
    },
    {
    "timestamp": {
    "gte": "2023-12-03T12:41:48.114Z"
    }
    },
    {
    "device_id": {
    "in": ["a1dd5533-136c-4672-9a7a-7e895303cc36"]
    }
    }
    ],
    "data_point_id": "82116d1c-7b07-44bb-81e6-c3672948736b"
    }

    Generated Query

    And this is the generated query from this JSON:

    SELECT time_bucket('\"1 days\"', timestamp) AS \"bucket\",avg(\"cupsBrewed\") AS \"cupsBrewed\" FROM \"coffeemachinetelemetry_aa99\"  WHERE (\"timestamp\" <= @timestamplte00) AND (\"timestamp\" >= @timestampgte11) AND (\"device_id\" IN (@deviceidin22))  GROUP BY \"bucket\",\"device_id\" LIMIT 50

    The named args will be replaced by query time args while fetching the data for this panel if provided, or the default values provided in the above JSON will be used.

    Take a look at the Data Config section for an in-depth guide on building your own SQL Query using our Dynamic Query Builder!

Types of Panels

  1. Line Chart
  2. Bar Chart