2.5.5 addline

Menu Information

Insert: Straight Line

Brief Information

Add a vertical or horizontal line to graph layer

Additional Information

Minimum Origin Version Required: 9.0

Command Line Usage

addline type:=1 value:=12 select:=1 name:=vline1;

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
Type type

Input

int

0
Specify which line to add, vertical or horizontal.

Option list:

  • Vertical (0)
    Add a vertical line on current active graph.
  • Horizontal (1)
    Add a horizontal line on current active graph.
At Value value

Input

double

<unassigned>
Specify the position of the added line in units of X Axis Scale (for Vertical Line) or Y Axis Scale (for Horizontal line). For categorical values, enter the index of desired category in categorical list to add line at that particular category. See example below for details.

You are also allowed to enter a LabTalk expression or an expression that incorporates one of Origin's built-in statistical functions, see the details here.

Color color

Input

int

0
Specify the color of the added line.
Style style

Input

int

0
Specify the style of the added line.

Option list:

  • solid:Solid (0)
    Specify the line style as Solid.
  • dash:Dash (1)
    Specify the line style as Dash.
  • dot:Dot (2)
    Specify the line style as Dot.
  • dash_dot:Dash Dot (3)
    Specify the line style as Dash Dot.
  • dash_dot_dot:Dash Dot Dot (4)
    Specify the line style as Dash Dot Dot.
  • short_dash:Short Dash (5)
    Specify the line style as Short Dash.
  • short_dot:Short Dot (6)
    Specify the line style as Short Dot.
  • short_dash_dot:Short Dash Dot (7)
    Specify the line style as Short Dash Dot.
Label Display Format format

Input

string

<auto>
Specify the label display format.
Label Location location

Input

int

0
Specify the label location.

Option list:

  • top:Top (0)
    Show the label on top of the added line.
  • bottom:Bottom (1)
    Show the label on bottom of the added line.
  • left:Left (2)
    Show the label on left of the added line.
  • right:Right (3)
    Show the label on right of the added line.
Selectable select

Input

int

1
Check this check box to allow the line to be selectable on graph.

If an object is made non-selectable it can be removed via script: label -r ObjectName; or you can use the Edit : Button Edit Mode menu option to make it selectable.

Moveable move

Input

int

1
Check this check box to allow the line to be moved on graph.

If an object is made non-moveable it can be removed by selecting it, right click and select Properties... to enter a new position on the Coordinates tab of the Object Properties dialog that opens.

Name name

Input

string

Specify the line name.

Description

This X-Function can be used to add vertical or Horizontal line on the graph.

Examples

This example will show you how to add a vertical line in a graph with categorical axis.

  1. Create a new workbook. Import data <Origin folder>\Samples\Data Manipulation\WeatherStations.dat. Right click on Col(Day) and select Set As Categorical. Highlight Col(Temperature) and Col(Presure), select Plot > Multi-Panel/Axis: Double-Y from menu to create a double-Y graph.
  2. Select Insert: Straight Line... from menu to open the addline dialog.
  3. With Vertical selected for Type by default, you will see a hint says "Axis scale is [x1,x2]. 1=Mon, ..., n=Fri". Enter 4 to add a vertical line at Thu. Then select Red for Color and Dash for Style.
    Addline 01.png
    Click OK. The graph should look like the follow.
    Addline 02.png