Introducing AG Grid Sparklines
Tags: releases, aggrid
Published: 2021-10-13 09:25:25

---
title: Introducing AG Grid Sparklines
published: true
date: 2021-10-07 11:40:34 UTC
tags: Releases, aggrid
canonical_url: https://blog.ag-grid.com/introducing-ag-grid-sparklines/
---

Author Credit: [Mana Peirov](https://blog.ag-grid.com/author/mana/)

![Introducing AG Grid Sparklines](https://blog.ag-grid.com/content/images/2021/10/Screenshot-2021-10-06-at-15.42.06.png)

AG Grid now provides built-in sparklines that are seamlessly integrated with the grid whilst offering superior performance.

[AG Grid Sparklines](https://www.ag-grid.com/javascript-data-grid/sparklines-overview/) are mini charts that are designed to be rendered inside grid cells. Due to their compact and uncluttered nature, they can provide clear insights into data trends, making them an invaluable addition across many applications.

To conserve memory and enhance performance, the grid will automatically create and destroy sparklines as they are scrolled in and out of view. Resizing grid columns will also cause the sparklines to resize accordingly. These are just some of the benefits provided by AG Grid Sparklines out-of-the-box.

## Enabling Sparklines

[Enabling sparklines](https://ag-grid.com/javascript-data-grid/sparklines-overview/#enabling-sparklines) in the grid is straightforward. All you need is just one line of code: adding a single built-in cell renderer – `agSparklineCellRenderer` to the column definition.

Since the built-in cell renderer has access to the row and its data, it takes care of supplying the sparkline data and automatically sizes the sparkline with the correct dimensions according to the cell width and height.

## Customisation

![Introducing AG Grid Sparklines](https://blog.ag-grid.com/content/images/2021/10/Screenshot-2021-10-06-at-16.33.24-2.png)<figcaption>Sparkline Types</figcaption>

The sparklines are fully customisable, with support for [line](https://ag-grid.com/javascript-data-grid/sparklines-line-customisation/), [column](https://ag-grid.com/javascript-data-grid/sparklines-column-customisation/) and [area](https://ag-grid.com/javascript-data-grid/sparklines-area-customisation/) sparkline types. To cater to various requirements and data types, the sparklines offer three different [x-axis types](https://ag-grid.com/javascript-data-grid/sparklines-axis-types/): [category](https://ag-grid.com/javascript-data-grid/sparklines-axis-types/#category-axis), [number](https://ag-grid.com/javascript-data-grid/sparklines-axis-types/#number-axis) and [time](https://ag-grid.com/javascript-data-grid/sparklines-axis-types/#time-axis). This ensures X values are scaled correctly along the horizontal axis, allowing for a more accurate and meaningful representation of the data.

For convenience, we have also designed the sparklines to accept three different [data formats](https://ag-grid.com/javascript-data-grid/sparklines-data/), including: [array of numbers](https://ag-grid.com/javascript-data-grid/sparklines-data/#array-of-numbers), [array of tuples](https://ag-grid.com/javascript-data-grid/sparklines-data/#array-of-numbers) and [array of objects](https://ag-grid.com/javascript-data-grid/sparklines-data/#array-of-numbers).

![Introducing AG Grid Sparklines](https://blog.ag-grid.com/content/images/2021/10/Screenshot-2021-10-07-at-11.18.58-1.png)<figcaption>Points of Interest</figcaption>

[Special points of interest](https://ag-grid.com/javascript-data-grid/sparklines-points-of-interest/) can be customised to highlight the important points for the users. For example, you could colour the columns which represent [negative](https://ag-grid.com/javascript-data-grid/sparklines-points-of-interest/) values in red, making them stand out to the users. It’s also possible to highlight the markers which represent [minimum and maximum](https://ag-grid.com/javascript-data-grid/sparklines-points-of-interest/) points, or the [first and last](https://ag-grid.com/javascript-data-grid/sparklines-points-of-interest/) values in the dataset. This feature allows quick comparisons across the values of a single sparkline or across multiple sparklines of the same type, which ultimately means easier and faster consumption of data.

The built-in tooltips give information about individual data points when users hover the sparklines. Given the sparklines show data trends in the context of the grid, the contents of the tooltips can be modified, allowing users the ability to display other row data.

![Introducing AG Grid Sparklines](https://blog.ag-grid.com/content/images/2021/10/Screenshot-2021-10-06-at-17.46.53.png)<figcaption>Sparkline Tooltips</figcaption>

## Summary

Sparklines can be a valuable addition and we hope you can use them to deliver a rich and compact visualisation of your data right inside the grid. The mini graphical depiction of a series of values in the grid can help your users see the bigger picture behind your data, instead of just considering values in isolation. This can improve the user experience and make users more productive when using your application.

We hope you can take advantage of AG Grid Sparklines to better communicate the story of your data.

You can find the full details and further capabilities of the sparklines in our [documentation](https://www.ag-grid.com/javascript-data-grid/sparklines-overview/).