The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 inserting arrows using script
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

zknauss

USA
72 Posts

Posted - 01/24/2023 :  11:29:42 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Good afternoon, I have the below script which I'm using to sort data based on pattern of change. Currently its operating how I intended but instead of outputting letters I'd like it to output Arrows representing the direction of change specifically what I'd like to have it output is below:

A = up arrow, color (red), shortcut key code: 2191
B = horrizontal bar, color (black), code: 2015
C = down arrow, color (blue), code: 2193

Thanks in advance for any help with this

for (int i = 1; i <= wks.ncols; i++ ){ range aa = [NCONFreReg]"Frequency_T1"!$(i+1); range bb = [NCONFreReg]"Frequency_T2"!$(i+1); %j=wcol(i)[1]$;
wcol(i)[2]$ =

if(bb[1]>0.01&&bb[1]>=aa[1]&&bb[2]<=aa,"A",

if(bb[1]>0.01&&bb[1]>=aa[1]&&aa==0&&bb[2]!=0,"A",

if(bb[1]>0.01&&bb[2]>aa && bb[2]<aa[9] && %j!="B","B",

if(bb[1]>0.01&&bb[1]<aa[1] && bb[2]>aa[9] && %j!="B","C","I")$)$)$)$; }


ZTK

YimingChen

1629 Posts

Posted - 01/24/2023 :  2:02:51 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Maybe you can use the Xfunction insertArrow:
https://www.originlab.com/doc/X-Function/ref/insertArrow

Go to Top of Page

zknauss

USA
72 Posts

Posted - 01/24/2023 :  2:34:45 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I'm not sure how I'd impliment that in the for/if statment or pull other symbols such as a horizontal bar.



ZTK
Go to Top of Page

YimingChen

1629 Posts

Posted - 01/24/2023 :  3:33:44 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
It works to include unicode symbols in the script. See below:

Edited by - YimingChen on 01/24/2023 3:37:19 PM
Go to Top of Page

zknauss

USA
72 Posts

Posted - 01/24/2023 :  3:52:59 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I'll give it a try in my script would the " " be nessasary for this to work? I tried using, col(1)[1]="↑"; and col(1)[1]=↑; but got a error message or an output of -- in the designated cell.

ZTK
Go to Top of Page

zknauss

USA
72 Posts

Posted - 01/24/2023 :  4:00:55 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Also is there a way to set the color of the arrow/symbol created? Thanks!

ZTK
Go to Top of Page

YimingChen

1629 Posts

Posted - 01/24/2023 :  5:30:45 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
1. You are missing the dollar sign. Try: col(1)[1]$=↑
2. set font color: wcellcolor type:=1 irng:=col(B) color:=2

Edited by - YimingChen on 01/24/2023 5:31:01 PM
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000