Quick Way to Remove Sparklines in Origin

Updated: 5/26/2022

Sparkline is a nice feature in Origin to quickly view the shape or distribution of the data across many columns without having to create graph windows.

sparklines_blog1

Each sparkline object is in fact an embedded graph so it can make your opj file size big and also slow things down such as importing data, openning the opj or switch folders in the project. That’s why by default we only add sparklines for data file with less than 50 columns. But it may happen that all your data files have less than 50 columns and you import a lot of data files. Then sparklines will be added during import to all columns. In such case, we would recommend you set Add Sparklines to No in Import dialogs, such as the following in ASCII Import dialog:

sparklines_blog3

Version 2022b (and Later)

Beginning with Origin 2022b, you have two easy options for removing sparklines:

  • To control display (e.g. prevent creation of new sparklines, plus hide existing sparklines on loading of project),  use LabTalk system variable @SPK.
  • To delete sparklines from the current project, use the LabTalk delete command.  Open the Script Window (Window: Script Window), type the following and press Enter:
del -spk

Version 2022 and Earlier

If you already have a project file with all sparklines in columns. Removing all these sparklines manually will be time consuming. So here we made a user-defined toolbar Sparklines.zip. Please download the zip file and unzip it. Then drag and drop the opx file into your running Origin workspace to install it.

A toolbar with two toolbar buttons will appear.

sparklines_blog2

Clicking the 1st button to deletes all sparklines in the opj.  Note: There is refresh issue so you may still see the sparklines in worksheet. But if you click on the worksheet, or switch between folders, the sparklines will be gone.

Click on the 2nd button to add sparklines to all columns in active sheet.

Here are the codes behind each button.

Delete Sparklines in whole opj file:

//start of the code

stringarray sa;

doc -e P //loop through all objects in project
{
if (%H == "sparklin*")
sa.Add(%H);
}

int nn = sa.GetSize();
for (int ii=1; ii<=nn; ii++)
{
win -c %(sa.GetAt(ii)$);
}

//end of the code

Add Sparklines to all columns in active sheet:

sparklines sel:=0;

Leave a Reply

Your email address will not be published. Required fields are marked *