2.2.3.26 sparklines

Menu Information

Add or Update Sparklines

Brief Information

Add sparkline graph to columns

Command Line Usage

1. sparklines logy:=1;

2. sparklines sel:=0 c1:=4 c2:=6;

3. sparklines iw:=[Book1]Sheet1! sel:=0 c1:=2 c2:=5;

4. sparklines iw:=[Book1]Sheet1! sel:=0 c1:=6 c2:=8 plottype:=box;

5. sparklines plottype:=1;

6. sparklines iw:=[Book1]Sheet1! sel:=0 c1:=6 c2:=8 template:=tabel row_height:=300 keepAspect:=0 label:=0 endpts:=0;

X-Function Execution Options

Please refer to the page for additional option switches when accessing the x-function from script

Variables

Display
Name
Variable
Name
I/O
and
Type
Default
Value
Description
Input Worksheet iw

Input

Worksheet

<active>

Specify the worksheet to manipulate. The default worksheet is the active worksheet.

Selected Columns sel

Input

int

1

By default, this option is enabled, which automatically uses the selected columns as input. If the box is cleared, the columns or range to add sparklines to should be specified in Column From and Column to below. Sparklines will be added to the specified columns.

Column From c1

Input

int

1

Specify from which column to be manipulated.

Column To c2

Input

int

0

Specify to which column to be manipulated.

Plot Type plottype

Input

int

0

Specify the plot type of the sparkline.
Option list:

  • line:Line
    Line
  • his:Histogram
    Histogram
  • box:Box
    Box chart
Graph Template template

Input

string

sparkline_label

Specify the template that will be used for the sparkline.

Row Height (percent) row_height

Input

int

200

Specify the sparkline row height. By default, it is double normal cell height.

Keep Aspect Ratio keepAspect

Input

int

0

Specify whether to keep aspect ratio of the sparklines. By default, this option is disabled and a change of aspect ratio in the graph will not show in the sparkline. If this box is selected, changing the aspect ratio of X and Y axes in the graph will change the aspect ratio on the sparkline.

Hide Annotations label

Input

int

1

If this box is checked, graph annotations are not shown in the sparkline. If the box is cleared, annotations will show. By default, annotations are hidden.

Show First and Last Points endpts

Input

int

1

If this box is checked, the first and last points will be marked in the sparklines.

Plot Y Against X xy

Input

int

0

Specify whether to plot the Y data against the associated X dataset. If disabled, data are plotted against row numbers.

Log10 X Scale logx

Input

int

0

Use log10 for X scale type. It is available only when "Line" is selected for Plot Type.

Log10 Y Scale logy

Input

int

0

Use log10 for Y scale type.

Description

The sparklines can display the profile of the data in any numeric or date/time column as a small graphical image that does not show associated x, y axes and labels etc. This feature is implemented according to the definition of sparklines by Edward Tufte. It gives the user a way to quickly view the general trend of the data across many Y columns in a sheet without having to create graph windows. Each Sparkline object is in fact an embedded graph which can be brought up for editing by double-clicking on the sparkline cell.

The Sparklines X-function is used to add or update sparkline in worksheet columns. It is accessible from main menu Column: Add or Update Sparklines when a workbook is active; or by right-clicking on column(s) or sparkline cell and selecting Add or Update Sparklines from the context menu.

Sparklines can, in large numbers, cause a slow-down in operations. If your project is difficult to work with and you suspect sparklines may be contributing, you can prevent sparkline creation and hide existing sparklines in the project using system variable @SPK. Additionally, you can delete sparklines from the current project using delete -spk.

Examples

In the command window, enter the following script:

sparklines row_height:=300 keepAspect:=0 plottype:=his;

This will add a histogram as sparkline to the active column.

Related X-Functions

insertSparklines, UpdateSparklines