SPARKLINE

Create a miniature chart contained within a cell.

Parameter List

Syntax
SPARKLINE(data
[options]
)
data

The range or array containing the data (eg. A1:A3 or A1:B3).

[optional] options

A range or array of optional settings and associated values used to customize the chart. Chart types:

  • line: for a line graph (default).

  • bar: for a stacked bar chart

  • column: for a column chart.

More details
  • If referencing a range, options should be two cells wide where the first cell is the option and the second cell is the value that option is set to.

    - charttype:

    • line: for a line graph.
  • bar: for a stacked bar chart

  • column: for a column chart

- charttype: line

  • xmin: sets the minimum value along the horizontal axis.

  • xmax: sets the maximum value along the horizontal axis.

  • ymin: sets the minimum value along the vertical axis.

  • ymax: sets the maximum value along the vertical axis.

  • color: sets the color of the line.

  • linewidth: determines how thick the line will be in the chart. A higher number means a thicker line.

  • empty: sets how to treat empty cells. Possible corresponding values include: "zero" or "ignore".

  • nan: sets how to treat cells with non-numeric data. Options are: "convert" and "ignore".

    - charttype: bar

  • max: sets the maximum value along the horizontal axis.

  • color1: sets the first color used for bars in the chart.

  • color2: sets the second color used for bars in the chart.

  • empty: sets how to treat empty cells. Possible corresponding values include: "zero" or "ignore".

  • nan: sets how to treat cells with non-numeric data. Options are: "convert" and "ignore".

    - charttype: column

  • color: sets the color of chart columns.

  • lowcolor: sets the color for the lowest value in the chart.

  • highcolor: sets the color for the higest value in the chart.

  • firstcolor: sets the color of the first column.

  • lastcolor: sets the color of the last column.

  • negcolor: sets the color of all negative columns.

  • axis: decides if an axis needs to be drawn (true/false).

  • axiscolor: sets the color of the axis (if applicable).

  • ymin: sets the custom minimum data value that should be used for scaling the height of columns.

  • ymax: sets the custom maximum data value that should be used for scaling the height of columns.

  • empty: sets how to treat empty cells. Possible corresponding values include: "zero" or "ignore".

  • nan: sets how to treat cells with non-numeric data. Options are: "convert" and "ignore".

Examples

SPARKLINE(A1:B3, '{"charttype": "column", "color": "grey"}') returns a graph with data from `A1:B3`