Skip to content

jx:sparkline

jx:sparkline inserts Excel sparklines — tiny charts that fit inside a single cell. Use them to show trends, distributions, or win/loss patterns right next to the data they represent.

jx:sparkline(lastCell="E1" type="line" dataRange="B1:D1")
jx:sparkline(lastCell="E1" type="column" dataRange="B1:D1")
jx:sparkline(lastCell="E1" type="winLoss" dataRange="B1:D1")
AttributeRequiredDescription
lastCellYesBottom-right cell of the sparkline area (typically the target cell)
typeYesSparkline type: line, column, winLoss
dataRangeYesThe range of cells containing the sparkline data (template-relative, auto-expanded)
colorSeriesNoSeries color (hex, e.g., #4472C4)
colorNegativeNoNegative value color
colorHighNoHighlight color for highest point
colorLowNoHighlight color for lowest point
colorFirstNoFirst point color
colorLastNoLast point color

Sparklines are perfect when you need trend context without taking up chart space:

  • Monthly revenue trend next to each product row
  • Quarterly performance history beside each employee
  • Win/loss indicators for sports data or A/B test results
  • Stock price mini-charts in a portfolio report
Section titled “Example: Line sparklines for monthly trends”
Cell A1 comment:
jx:area(lastCell="E10")
jx:each(items="products" var="p" lastCell="E1")
Cell E1 comment:
jx:sparkline(lastCell="E1" type="line" dataRange="B1:D1")

Cell A1: ${p.Name}, B1: ${p.Jan}, C1: ${p.Feb}, D1: ${p.Mar}, E1 gets a sparkline.

Each product row shows a mini line chart of its 3-month trend in column E. Users scan down the column to spot which products are trending up or down — no separate chart needed.

jx:sparkline(lastCell="E1" type="column" dataRange="B1:D1" colorSeries="#4472C4")

Bar-style sparklines. Good for comparing discrete values (quarterly revenue, monthly counts).

jx:sparkline(lastCell="F1" type="winLoss" dataRange="B1:E1")

Binary up/down indicators. Positive values show as up bars, negative as down bars. Perfect for game results, pass/fail sequences, or month-over-month change direction.

Like charts and tables, sparklines use deferred execution. The sparkline definitions are collected during processing and applied after all rows are written, ensuring data ranges reference the correct output cells.

Control print layouts with page breaks:

jx:pageBreak →