Using a string list to name graph objects

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt

Elderfield.A
Posts: 78
Joined: Thu Jul 11, 2019 10:47 pm

Using a string list to name graph objects

Postby Elderfield.A » Sun Aug 11, 2019 10:48 pm

Hi,

I am using a string list to name the variables in a graph, I want be call them different names to their variable names and these names will have spaces in them:

Code: Select all

for !h =1 to chart1.@count  ' this is a group of variables
      %4 = @wordq(%labels, !h)  ' this is my string list - it looks like this  %labels = """name one"" ""name two"""
      graph_one.name({!h}) %4   ' this is changing the name in the graph to the one in the list
   next


But when the graph is generated, the name object name has quotations marks around it - "name one".

Would be great to remove these quotation marks.

Thanks

Adam

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13319
Joined: Tue Sep 16, 2008 5:38 pm

Re: Using a string list to name graph objects

Postby EViews Gareth » Sun Aug 11, 2019 11:57 pm

{%4}
Follow us on Twitter @IHSEViews

Elderfield.A
Posts: 78
Joined: Thu Jul 11, 2019 10:47 pm

Re: Using a string list to name graph objects

Postby Elderfield.A » Mon Aug 12, 2019 3:53 pm

Thanks for the response Gareth, this was the first thing that I tried and was still not able to achieve the desired outcome. Any other suggestions? A couple of further points may be useful:

1) when I type in the name I don't get the issue:

Code: Select all

graph_one.name({!h}) name one


But this is not an option (to manually name each series) as this bit of code forms part of a subrountine that I can call quickly and easily make charts that formatted to my liking, and data labeled how I like.

2) when giving a chart a heading using the same approach using the graph.addtext command, I don't have the issue.

Grateful for your assistance.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13319
Joined: Tue Sep 16, 2008 5:38 pm

Re: Using a string list to name graph objects

Postby EViews Gareth » Wed Aug 14, 2019 7:44 am

Code: Select all

%4 = @stripquotes(%4)
graph_one.name(!h) {%4}
Follow us on Twitter @IHSEViews

Elderfield.A
Posts: 78
Joined: Thu Jul 11, 2019 10:47 pm

Re: Using a string list to name graph objects

Postby Elderfield.A » Wed Aug 14, 2019 4:00 pm

Thanks Gareth - that did the trick.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 38 guests