# Sparklines in Tables

## Overview

myIO’s sparkline mode renders compact, axes-free charts at 20px height, ideal for embedding inline in table cells. Enable it with `sparkline = TRUE`:

    myIO(data.frame(x = 1:20, y = cumsum(rnorm(20))), sparkline = TRUE) |>
      addIoLayer("line", label = "trend", mapping = list(x_var = "x", y_var = "y"))

## Supported types

    df <- data.frame(x = 1:12, y = c(4, 6, 5, 8, 7, 9, 6, 10, 8, 11, 9, 12))

    # Line sparkline
    myIO(df, sparkline = TRUE) |>
      addIoLayer("line", label = "line", mapping = list(x_var = "x", y_var = "y"))

    # Bar sparkline
    myIO(df, sparkline = TRUE) |>
      addIoLayer("bar", label = "bars", mapping = list(x_var = "x", y_var = "y"))

    # Area sparkline
    myIO(df, sparkline = TRUE) |>
      addIoLayer("area", label = "area", mapping = list(x_var = "x", y_var = "y"))

## What sparkline mode does

- Strips axes, legend, reference lines, and all interactions
- Sets margins to 1px
- Defaults height to 20px, width to 100%
- Only supports `line`, `bar`, and `area` types