> For the complete documentation index, see [llms.txt](https://docs.rowsncolumns.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rowsncolumns.app/configuration/features/sparklines.md).

# Sparklines

Sparklines are mini-charts rendered inside a single cell. They're authored as `SPARKLINE()` formulas, which means they live alongside the rest of the calculation graph — referenced cells recompute the sparkline on change, copy/paste duplicates the formula, and XLSX + ODS round-trip preserves every option.

## Basic usage

Type `=SPARKLINE(A1:A10)` into a cell. The cell's effective value becomes a `sparkline` structured value, the renderer paints the chart, and the formula bar still shows the source.

```
A1:A10 = numeric values
B1     = =SPARKLINE(A1:A10)        // line sparkline (default)
B2     = =SPARKLINE(A1:A10, {"charttype","column"})
B3     = =SPARKLINE(A1:A10, {"charttype","winloss"})
```

## Options

`SPARKLINE` takes an optional second argument — a flat array of `"key", value` pairs in Excel array literal syntax (`{…}`). All options round-trip both directions through XLSX (`<x14:sparklineGroup>` attributes) and via SPARKLINE formula text.

### Chart type + color

```
=SPARKLINE(A1:A10, {"charttype","line"})
=SPARKLINE(A1:A10, {"charttype","column"})
=SPARKLINE(A1:A10, {"charttype","winloss"})
=SPARKLINE(A1:A10, {"color","#638ec6"})
```

### Axis options

```
// Render an X-axis line
=SPARKLINE(A1:A10, {"axis",TRUE})

// Plot empty cells as zero (default: gap)
=SPARKLINE(A1:A10, {"emptycells","zero"})

// Or connect across blanks
=SPARKLINE(A1:A10, {"emptycells","span"})

// Treat the X axis as a date axis (when paired with a date series)
=SPARKLINE(A1:A10, {"dateaxis",TRUE})
```

### Point highlights

```
=SPARKLINE(A1:A10, {
  "markers",TRUE,           // line sparkline: diamond markers at every point
  "highpoint",TRUE,         // highlight the maximum
  "lowpoint",TRUE,          // highlight the minimum
  "firstpoint",TRUE,        // highlight the first point
  "lastpoint",TRUE,         // highlight the last point
  "negativepoints",TRUE     // column/winloss: color negative bars differently
})
```

### Axis bounds

By default each sparkline scales to its own min/max ("individual"). Switch to a group-wide or custom scale:

```
// Use a custom max + min instead of auto
=SPARKLINE(A1:A10, {"max",100, "min",-10})

// Scale to the group of sparklines in the same x14:sparklineGroup
=SPARKLINE(A1:A10, {"minaxistype","group", "maxaxistype","group"})

// Custom — exact values from max/min
=SPARKLINE(A1:A10, {"minaxistype","custom", "maxaxistype","custom"})
```

### Line weight

```
=SPARKLINE(A1:A10, {"lineweight",2.5})    // line sparkline only
```

### Composing options

Combine any of the above in a single options block:

```
=SPARKLINE(A1:A10, {
  "charttype","line",
  "color","#1d4ed8",
  "markers",TRUE,
  "highpoint",TRUE,
  "lowpoint",TRUE,
  "lineweight",2,
  "emptycells","span"
})
```

## XLSX round-trip

Sparklines export as `<x14:sparklineGroup>` blocks inside the worksheet's `extLst`. Two sparklines share a group when every axis option matches; distinct settings each get their own group block. The exporter follows Excel's grouping rule precisely so a saved-and-reopened file produces the same UI.

The legacy default highlight behavior (markers + high + low for line; high + low + negative for column / winloss) ships unchanged for bare `SPARKLINE(range)` formulas without explicit options.

## ODS round-trip

LibreOffice's `calcext:sparkline-groups` extension is parsed on import and emitted on export.

## Working with structured values

A sparkline cell's `ev.structuredValue` is a `SparkLineResult`:

```ts
type SparkLineResult = {
  kind: "sparkline";
  data: number[];
  options: Record<string, string | number | boolean>;
};
```

Custom renderers can read this directly and replace the default chart implementation.
