---
title: "Sparklines Overview"
enterprise: true
framework: vue
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:

```ts
<ag-grid-vue
    :columnDefs="columnDefs"
    /* other grid options ... */>
</ag-grid-vue>

this.columnDefs = [
    {
        field: 'change',
        cellRenderer: 'agSparklineCellRenderer',
    },
    // other column definitions ...
];
```

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/vue-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/vue-data-grid/sparklines-data/) is required.

#### Enabling Sparklines

```ts
import {
  createApp,
  defineComponent,
  onBeforeMount,
  ref,
  shallowRef,
} from "vue";
import { AgGridVue } from "ag-grid-vue3";
import { AgChartsCommunityModule } from "ag-charts-community";
import {
  ClientSideRowModelModule,
  ColDef,
  ColGroupDef,
  GridApi,
  GridOptions,
  GridReadyEvent,
  ModuleRegistry,
  enableDevValidations,
} from "ag-grid-community";
import {
  ClipboardModule,
  ContextMenuModule,
  SparklinesModule,
} from "ag-grid-enterprise";
import { getData } from "./data";
if (process.env.NODE_ENV !== "production") {
  enableDevValidations();
}

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

const VueExample = defineComponent({
  template: `
        <div style="height: 100%">
                <ag-grid-vue
      style="width: 100%; height: 100%;"
      @grid-ready="onGridReady"
      :columnDefs="columnDefs"
      :defaultColDef="defaultColDef"
      :rowData="rowData"
      :rowHeight="rowHeight"></ag-grid-vue>
        </div>
    `,
  components: {
    "ag-grid-vue": AgGridVue,
  },
  setup(props) {
    const gridApi = shallowRef<GridApi | null>(null);
    const columnDefs = ref<ColDef[]>([
      { field: "symbol", maxWidth: 120 },
      { field: "name", minWidth: 250 },
      {
        field: "change",
        cellRenderer: "agSparklineCellRenderer",
      },
      {
        field: "volume",
        maxWidth: 140,
      },
    ]);
    const defaultColDef = ref<ColDef>({
      flex: 1,
      minWidth: 100,
    });
    const rowData = ref<any[] | null>(getData());
    const rowHeight = ref(50);

    const onGridReady = (params: GridReadyEvent) => {
      gridApi.value = params.api;
    };

    return {
      gridApi,
      columnDefs,
      defaultColDef,
      rowData,
      rowHeight,
      onGridReady,
    };
  },
});

const app = createApp(VueExample);
app.mount("#app");
```

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

## 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:

```ts
<ag-grid-vue
    :columnDefs="columnDefs"
    /* other grid options ... */>
</ag-grid-vue>

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

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

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

The following sections are relevant to all sparkline types:

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