# Time Series widget

Time Series Widget allows you to identify insights and patterns from your data over a period of time. To use it, ensure your data source includes a valid timestamp.

<figure><img src="https://3029946802-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FybPdpmLltPkzGFvz7m8A%2Fuploads%2Fgit-blob-a36e69c1575850df38803c75d207edab92f823c8%2Fimage.png?alt=media" alt=""><figcaption><p><em>Time Series Widget displaying traffic accidents over time</em></p></figcaption></figure>

### Widget data

When configuring a Time Series Widget, you have the flexibility to choose from a *provided aggregation list* that includes `COUNT`, `AVG`, `MAX`, `MIN`, and `SUM` to define the metric to be displayed in the widget.

<figure><img src="https://3029946802-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FybPdpmLltPkzGFvz7m8A%2Fuploads%2Fgit-blob-89e9d422c9a8e625e759307d23dcc31b874101a8%2Fimage.png?alt=media" alt=""><figcaption><p>Define metric operation and aggregation column</p></figcaption></figure>

For more complex and custom calculations, you can select the *custom aggregation* option to create your own SQL Expression. With this option, you can use a wide range of SQL functions, operators and syntax using single or multiple columns from your data source.

<figure><img src="https://3029946802-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FybPdpmLltPkzGFvz7m8A%2Fuploads%2Fgit-blob-48afcf057d820b0d315c3c7368758e3cebfd120c%2Fimage.png?alt=media" alt=""><figcaption><p><em>Custom aggregation using SQL Expression</em></p></figcaption></figure>

**Multiple series** can be visualized in the widget to compare trends. You can create multiple series using one of the following options: "Split by" and "Add metrics"

<figure><img src="https://3029946802-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FybPdpmLltPkzGFvz7m8A%2Fuploads%2Fgit-blob-ca23aa566861f49cda6e3c2037433afa5f243b4d%2Fimage.png?alt=media" alt=""><figcaption><p><em>Multiple Series options</em></p></figcaption></figure>

* **Split by:** To split a single series into multiple segments, simply specify a "Split by" category field. For instance, in a dataset tracking traffic accidents, you define your primary metric as the "COUNT" of records and use the "Split by" category column as "accident\_severity". The widget will then present the "COUNT" of each unique accident severity category as separate series.
* **Add metrics**: If you want to incorporate more data dimensions into your visualization, utilize the "Add metrics" option. For example, in a traffic accident dataset, you can define your initial metric as the "SUM" of cycles affected at accident spots. Subsequently, you can add another metric to calculate the "SUM" of motorcycles affected. The resultant widget will display two distinct series: one representing the sum of cycles and the other representing the sum of motorcycles for each specified time interval.

<figure><img src="https://3029946802-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FybPdpmLltPkzGFvz7m8A%2Fuploads%2Fgit-blob-2797ca7f65b04f460fa3a790edfc17fc09b73c56%2Fimage.png?alt=media" alt=""><figcaption><p><em>Traffic accident records split by accident severity</em></p></figcaption></figure>

{% hint style="info" %}
Note that the Time Series widget can support up to 10 different series. When using split by option, the most dominant categories will be automatically selected.
{% endhint %}

### Widget display

You can choose between **Line and Bar chart styles** in the Display Options. Line charts are ideal for visualizing continuous trends, while Bar charts are better suited for discrete time periods such as monthly volumes or event counts.&#x20;

<figure><img src="https://3029946802-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FybPdpmLltPkzGFvz7m8A%2Fuploads%2FugCVcbQBq8sapwLE3gsk%2FScreenshot%202026-03-13%20at%2011.41.59.png?alt=media&#x26;token=36205c23-b134-410f-9c9a-217904b81aa7" alt=""><figcaption></figcaption></figure>

Temporal data is organized into discrete time intervals along the x-axis of the widget. By default, an **interval** size is automatically selected, but you have the flexibility to manually adjust it as needed.

<figure><img src="https://3029946802-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FybPdpmLltPkzGFvz7m8A%2Fuploads%2Fgit-blob-09699f7947f8695571366f1fc3a9411b8459d1c6%2Fimage.png?alt=media" alt=""><figcaption><p><em>Set custom temporal interval</em></p></figcaption></figure>

You can empower users to animate moving geometry features by adding **animation controls**. You can click the clock icon to adjust speeds: 0.5x, 1x, 2x, or 3x.

<figure><img src="https://3029946802-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FybPdpmLltPkzGFvz7m8A%2Fuploads%2Fgit-blob-de8bb0c56d7c7b53e596d99266a172c6a6819d3b%2Fimage.png?alt=media" alt=""><figcaption><p><em>Animation controls on Time Series Widget</em></p></figcaption></figure>

{% hint style="info" %}
Animation support on the Time Series widget is currently not available for aggregated sources such as point aggregated such as heatmap, cluster, etc. or aggregated spatial index sources such as h3 or quadbin.
{% endhint %}

In the display section, you can also use **formatting** to choose the unit of metrics displayed on the y-axis. Additionally, you can add **notes** that support [Markdown syntax](https://www.markdownguide.org/basic-syntax/).

### Widget behavior

Within the "Behavior" section, you can define how your widget operates: choose between **"Viewport" or "Global" modes**. Additionally, you can make your widgets **collapsible**, allowing you to hide them when needed.

You can also enable or disable the widget’s filtering capability using the **cross-filtering** toggle icon. When enabled, the widget can filter itself and other components connected to the **same data source** or across **multiple sources** if they share the same property.

{% hint style="info" %}
The **Time Series widget** supports cross-filtering across multiple sources **only over the temporal property**. Split by property is not supported.
{% endhint %}

Learn more about widget behavior [here](https://docs.carto.com/carto-user-manual/maps/widgets/..#widget-behaviour).

## **Best practices to work with temporal data**

When dealing with temporal data sources, we advocate the following best practices:

* **Large temporal data**: When working with large temporal data, consider aggregating your data to a higher temporal granularity and using Time Series Widget in combination with Date SQL Parameter. These recommendations can help reduce the volume of data and enhance performance
* **Static geometries**: If you are working with static geometry whose attributes change over time, we recommend you aggregate your source grouping by geometry to avoid displaying duplicated geometries on the map. You can also leverage the "Date" type of SQL Parameter to dynamically define the date range of your source.
* **Animation:** Animation is primarily recommended for geometries that exhibit movement over time. If you are interested on animation for static geometry whose attributes vary over time please [let us know](mailto:feedback@carto.com).

{% hint style="info" %}
Time Series Widget is not available for raster or pre-generated Tilesets sources. Note also that only one Time Series Widget per map is permitted.
{% endhint %}
