---
title: Integrate Grafana with Tiger Cloud | Tiger Data Docs
description: Query, visualize, and explore your data with interactive dashboards
---

[Grafana](https://grafana.com/docs/) is an open-source analytics and visualization platform that enables you to query, visualize, alert on, and explore your metrics, logs, and traces wherever they’re stored.

This page shows you how to integrate Grafana with a Tiger Cloud service, create a dashboard and panel, then visualize geospatial data.

## Prerequisites

To follow the steps on this page:

- Create a target [Tiger Cloud service](/docs/get-started/quickstart/create-service/index.md) with the Real-time analytics capability.

  You need your [connection details](/docs/integrate/find-connection-details/index.md).

* Install [self-managed Grafana](https://grafana.com/get/?tab=self-managed) or sign up for [Grafana Cloud](https://grafana.com/get/).

## Connect Grafana to Tiger Cloud

To visualize the results of your queries, enable Grafana to read the data in your service:

1. **Log in to Grafana**

   In your browser, log in to either:

   - Self-hosted Grafana: at `http://localhost:3000/`. The default credentials are `admin`, `admin`.
   - Grafana Cloud: use the URL and credentials you set when you created your account.

2. **Add your service as a data source**

   1. Open `Connections` > `Data sources`, then click `Add new data source`.

   2. Select `{C.PG}` from the list.

   3. Configure the connection:

      - `Host URL`, `Database name`, `Username`, and `Password`, configure using your [connection details](/docs/integrate/find-connection-details/index.md). `Host URL` is in the format `<host>:<port>`.
      - `TLS/SSL Mode`: select `require`.
      - `{C.PG} options`: enable `TimescaleDB`.
      - Leave the default setting for all other fields.

   4. Click `Save & test`.

      Grafana checks that your details are set correctly.

## Create a Grafana dashboard and panel

Grafana is organized into dashboards and panels. A dashboard represents a view into the performance of a system, and each dashboard consists of one or more panels, which represent information about a specific metric related to that system.

To create a new dashboard:

1. **On the `Dashboards` page, click `New` and select `New dashboard`**

2. **Click `Add visualization`**

3. **Select the data source**

   Select your service from the list of pre-configured data sources or configure a new one.

4. **Configure your panel**

   Select the visualization type. The type defines specific fields to configure in addition to standard ones, such as the panel name.

5. **Run your queries**

   You can edit the queries directly or use the built-in query editor. If you are visualizing time-series data, select `Time series` in the `Format` drop-down.

6. **Click `Save dashboard`**

   You now have a dashboard with one panel. Add more panels to a dashboard by clicking `Add` at the top right and selecting `Visualization` from the drop-down.

## Use the time filter function

Grafana time-series panels include a time filter:

1. **Call `$__timefilter()` to link the user interface construct in a Grafana panel with the query**

   For example, to set the `pickup_datetime` column as the filtering range for your visualizations:

   ```
   SELECT
     --1--
     time_bucket('1 day', pickup_datetime) AS "time",
     --2--
     COUNT(*)
   FROM rides
   WHERE $__timeFilter(pickup_datetime)
   ```

2. **Group your visualizations and order the results by [time buckets](/docs/reference/timescaledb/hyperfunctions/time-series-utilities/time_bucket/index.md)**

   In this case, the `GROUP BY` and `ORDER BY` statements reference `time`.

   For example:

   ```
   SELECT
     --1--
     time_bucket('1 day', pickup_datetime) AS time,
     --2--
     COUNT(*)
   FROM rides
   WHERE $__timeFilter(pickup_datetime)
   GROUP BY time
   ORDER BY time
   ```

   When you visualize this query in Grafana, you see this:

   ![Grafana panel showing query results from Tiger Cloud](/docs/_astro/grafana_query_results.DJAqOxI-_Z1xRKp0.webp)

   You can adjust the `time_bucket` function and compare the graphs:

   ```
   SELECT
     --1--
     time_bucket('5m', pickup_datetime) AS time,
     --2--
     COUNT(*)
   FROM rides
   WHERE $__timeFilter(pickup_datetime)
   GROUP BY time
   ORDER BY time
   ```

   When you visualize this query, it looks like this:

   ![Grafana panel showing query results aggregated in 5-minute time buckets](/docs/_astro/grafana_query_results_5m.BrSMXMw__ZMMOVQ.webp)

## Visualize geospatial data

Grafana includes a Geomap panel so you can see geospatial data overlaid on a map. This can be helpful to understand how data changes based on its location.

This section visualizes taxi rides in Manhattan, where the distance traveled was greater than 5 miles. It uses the same query as the [NYC Taxi Cab](/docs/build/examples/analyze-transport-data/index.md) tutorial as a starting point.

1. **Add a geospatial visualization**

   1. In your Grafana dashboard, click `Add` > `Visualization`.

   2. Select `Geomap` in the visualization type drop-down at the top right.

2. **Configure the data format**

   1. In the `Queries` tab below, select your data source.

   2. In the `Format` drop-down, select `Table`.

   3. In the mode switcher, toggle `Code` and enter the query, then click `Run`.

      For example:

      ```
      SELECT time_bucket('5m', rides.pickup_datetime) AS time,
             rides.trip_distance AS value,
             rides.pickup_latitude AS latitude,
             rides.pickup_longitude AS longitude
      FROM rides
      WHERE rides.trip_distance > 5
      GROUP BY time,
               rides.trip_distance,
               rides.pickup_latitude,
               rides.pickup_longitude
      ORDER BY time
      LIMIT 500;
      ```

3. **Customize the Geomap settings**

   With default settings, the visualization uses green circles of the fixed size. Configure at least the following for a more representative view:

   - `Map layers` > `Styles` > `Size` > `value`.

     This changes the size of the circle depending on the value, with bigger circles representing bigger values.

   - `Map layers` > `Styles` > `Color` > `value`.

   - `Thresholds` > Add `threshold`.

     Add thresholds for 7 and 10, to mark rides over 7 and 10 miles in different colors, respectively.

   You now have a visualization that looks like this:

   ![Grafana dashboard connected to Tiger Cloud](/docs/_astro/timescale-grafana-integration.BnZybwp-_Z2arOYi.webp)
