All Sparkline Line Chart Options in Google Sheets (Formula Examples)

Published on

Most users customize only the color and line width in Sparkline Line charts. But there are more options available. In this guide, I’ll show you how to use all the Sparkline Line Chart Options in Google Sheets—so you can better understand and modify advanced formulas when you come across them.

What Is a Sparkline Line Chart?

A Sparkline Line chart is a mini line graph in a single cell that helps you quickly visualize changes over time. It’s ideal for tracking trends without using a full chart.

All Available Sparkline Line Chart Formula Options

Syntax

SPARKLINE(data, [options])

Here’s a full example that includes all the line chart options:

=SPARKLINE(D2:O3, A2:B11)
Example of all available options used in a Sparkline line chart formula in Google Sheets

Or using inline parameters:

=SPARKLINE(D2:O3, {
  "charttype","line";
  "color","red";
  "empty","ignore";
  "nan","ignore";
  "rtl",false;
  "linewidth",2;
  "xmin",1;
  "xmax",12;
  "ymin",MIN(D3:O3);
  "ymax",MAX(D3:O3)
})

You can also skip options entirely:

=SPARKLINE(D2:O3)

The chart still works—just with default settings.

1. Color and Line Width Options

To change the line color and thickness, use the "color" and "linewidth" options:

=SPARKLINE(D2:O3, {
  "charttype","line";
  "color","red";
  "linewidth",3
})
Customizing the color and line thickness in a line Sparkline chart using formula options

2. Handling Empty and Non-Numeric Values

Use the "empty" and "nan" options to control how Sparkline treats missing or invalid data.

“empty” Option

=SPARKLINE(D2:O3, {"charttype","line";"color","red";"linewidth",3;"empty","zero"})
=SPARKLINE(D2:O3, {"charttype","line";"color","red";"linewidth",3;"empty","ignore"})
  • “zero”: treats empty cells as 0.
  • “ignore”: skips empty cells.
Comparison of Sparkline behavior when empty cells are treated as zero versus ignored

“nan” Option

If a cell contains non-numeric text like "Nil":

=SPARKLINE(D2:O3, {"charttype","line";"color","red";"linewidth",3;"nan","convert"})
=SPARKLINE(D2:O3, {"charttype","line";"color","red";"linewidth",3;"nan","ignore"})
  • “convert”: converts text to 0.
  • “ignore”: ignores it completely.

3. Draw the Line from Right to Left (RTL)

Use "rtl" to reverse the direction of the chart:

=SPARKLINE(D2:O3, {"charttype","line";"color","red";"linewidth",3;"rtl",true})

4. Set Axis Limits: "xmin", "xmax", "ymin", "ymax"

Sparkline auto-detects y-axis bounds, but you can define them:

=SPARKLINE(D3:O3, {"charttype","line";"ymin",MIN(D3:O3);"ymax",MAX(D3:O3)})

Set X-Axis Min/Max

You can use "xmin" and "xmax" to filter the x-values only if you provide an explicit x-axis row. If you omit the x-axis, these settings won’t filter the data—they’ll have no visible effect on the chart.

To demonstrate, I’ll use virtual arrays created with HSTACK and VSTACK functions instead of real cell ranges.

How xmin and xmax filter data points when an x-axis is specified in a line Sparkline chart

Example 1:

=SPARKLINE(VSTACK(HSTACK(1, 2, 3, 4, 5, 6, 7), HSTACK(10, 20, 15, 25, 12, 30, 18)), 
 {"charttype","line";"xmin",2;"xmax",6})

Here, the first row represents the x-axis values:
{1, 2, 3, 4, 5, 6, 7}
The second row is the y-values:
{10, 20, 15, 25, 12, 30, 18}

Since "xmin" is 2 and "xmax" is 6, only the y-values corresponding to x = 2 through x = 6 are plotted:
{20, 15, 25, 12, 30}

Example 2:

=SPARKLINE(HSTACK(20, 15, 25, 12, 30), {"charttype","line"})

This uses just those same five y-values directly, without an x-axis.

Note: When "xmin" and "xmax" are used with an explicit x-axis, Sparkline filters the y-values that fall within that x-range. It does not affect the axis scale alone—it determines which data points are drawn.

Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Guide Prashanth KV brings a wealth of experience in Google Sheets and Excel, cultivated through years of work with multinational corporations in Mumbai and Dubai. As a recognized Google Product Expert in Docs Editors, Prashanth shares his expertise through insightful blogging since 2012. Explore his blog for practical tips and guidance on maximizing your spreadsheet skills.

Top N Products and Top N Sellers in Google Sheets (Top N of Top N)

If you’ve ever wanted to compare which sellers contribute the most to your top-selling...

Use XLOOKUP in a Structured Table in Google Sheets (Single and Multiple Conditions)

This tutorial is for users who want to apply XLOOKUP inside a structured table...

Reset SCAN by Another Column in Google Sheets and Excel

Resetting SCAN function results based on values in another column is a topic of...

How to Get the Fastest Time for Each Person in Google Sheets

Whether you’re tracking race results, event times, or any other timed activities, finding the...

More like this

Top N Products and Top N Sellers in Google Sheets (Top N of Top N)

If you’ve ever wanted to compare which sellers contribute the most to your top-selling...

Use XLOOKUP in a Structured Table in Google Sheets (Single and Multiple Conditions)

This tutorial is for users who want to apply XLOOKUP inside a structured table...

How to Get the Fastest Time for Each Person in Google Sheets

Whether you’re tracking race results, event times, or any other timed activities, finding the...

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.