---
title: "Sparklines Overview"
enterprise: true
framework: javascript
version: "36.1.0"
---

# Sparklines Overview

This section introduces the grid's built-in Sparklines - mini charts that are optimised for grid cells that can be used to provide insights into data trends at a glance. These sparklines can be fully customised to application's requirements.

![Sparkline Overview](https://www.ag-grid.com/_astro/sparklines-overview.CNaxBxC7.png)

## Enabling Sparklines

To enable sparklines on a particular column, add the `agSparklineCellRenderer` as shown below:

```js
const gridOptions = {
    columnDefs: [
        {
            field: 'change',
            cellRenderer: 'agSparklineCellRenderer',
        },
        // other column definitions ...
    ],

    // other grid options ...
}
```

Note in the snippet above that specifying an `agSparklineCellRenderer` will display the data using the default `line` sparkline.

The following example shows the minimum configuration required to display data in a sparkline. Note the following:

- The **Change** column is configured to use an `agSparklineCellRenderer`.
- No sparkline options are supplied to the `agSparklineCellRenderer` so the default [Line Sparkline](https://www.ag-grid.com/javascript-data-grid/sparklines-line-customisation/) is used.
- An array of numbers is supplied as data to the **Change** column, which means no [Data Mapping](https://www.ag-grid.com/javascript-data-grid/sparklines-data/) is required.

#### Enabling Sparklines

```ts
import { AgChartsCommunityModule } from "ag-charts-community";
import {
  ClientSideRowModelModule,
  GridApi,
  GridOptions,
  ModuleRegistry,
  createGrid,
  enableDevValidations,
} from "ag-grid-community";
import {
  ClipboardModule,
  ContextMenuModule,
  SparklinesModule,
} from "ag-grid-enterprise";
import { getData } from "./data";

// Enable extended validations only for development
if (process.env.NODE_ENV !== "production") {
  enableDevValidations();
}

ModuleRegistry.registerModules([
  ClientSideRowModelModule,
  SparklinesModule.with(AgChartsCommunityModule),
  ClipboardModule,
  ContextMenuModule,
]);

let gridApi: GridApi;

const gridOptions: GridOptions = {
  columnDefs: [
    { field: "symbol", maxWidth: 120 },
    { field: "name", minWidth: 250 },
    {
      field: "change",
      cellRenderer: "agSparklineCellRenderer",
    },
    {
      field: "volume",

      maxWidth: 140,
    },
  ],
  defaultColDef: {
    flex: 1,
    minWidth: 100,
  },
  rowData: getData(),
  rowHeight: 50,
};

const gridDiv = document.querySelector<HTMLElement>("#myGrid")!;
gridApi = createGrid(gridDiv, gridOptions);
```

[Live example: Enabling Sparklines](https://www.ag-grid.com/examples/sparklines-overview/enabling-sparklines/typescript)

## Sparkline Customisation

The default Sparkline options act as a good starting point for most applications, however sparklines can be fully customised by overriding the default sparkline options.

Sparklines are customised by supplying `sparklineOptions` to the `cellRendererParams` on the Sparkline Cell Renderer as shown below:

```js
const gridOptions = {
    columnDefs: [
        {
            cellRenderer: 'agSparklineCellRenderer',
            cellRendererParams: {
                sparklineOptions: {
                    // Sparkline customisation goes here.
                }
            },
        },
        // other column definitions ...
    ],

    // other grid options ...
}
```

Each Sparkline type contains specific `sparklineOptions` that can be overridden and are covered in the following sections:

- [Area Customisation](https://www.ag-grid.com/javascript-data-grid/sparklines-area-customisation/)
- [Bar Customisation](https://www.ag-grid.com/javascript-data-grid/sparklines-bar-customisation/)
- [Column Customisation](https://www.ag-grid.com/javascript-data-grid/sparklines-column-customisation/)
- [Line Customisation](https://www.ag-grid.com/javascript-data-grid/sparklines-line-customisation/)

The following sections are relevant to all sparkline types:

- [Sparkline Data](https://www.ag-grid.com/javascript-data-grid/sparklines-data/) - compares the different data formats that can be supplied to sparklines.
- [Axis Types](https://www.ag-grid.com/javascript-data-grid/sparklines-axis-types/) - compares the different axis types available to sparklines.
- [Sparkline Tooltips](https://www.ag-grid.com/javascript-data-grid/sparklines-tooltips/) - covers the various ways sparkline tooltips can be customised.
- [Points of Interest](https://www.ag-grid.com/javascript-data-grid/sparklines-points-of-interest/) - shows how points of interest can be formatted on sparklines.
- [Sparklines API](https://www.ag-grid.com/javascript-data-grid/sparklines-api-sparkline-options/) - shows more details on APIs available when using sparklines.
