More graph programming questions

For questions regarding programming in the EViews programming language.

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

barteph
Posts: 9
Joined: Tue Apr 01, 2014 8:50 pm

More graph programming questions

Postby barteph » Wed Apr 02, 2014 4:05 am

How do I program so that the series in a line graph are renamed?

For instance, if I have F_VA, G_VA and I want these to show up in ledgend as "France Value Added" and "Germany Value Added"

How would I program a graph with 2 axes, where one of the axes is inverted?

say for instance, I have F_CAPEX and EU_UNCERTAINTY, France Capex and the EU uncertainty index. I want the EU uncertainty index to show up on an axes that is inverted.

Many thanks

EViews Jason
EViews Developer
Posts: 870
Joined: Tue Sep 16, 2008 3:50 pm

Re: More graph programming questions

Postby EViews Jason » Wed Apr 02, 2014 10:13 am

Use:

Code: Select all

mygraph.name(1) France Value Added mygraph.name(2) Germany Value Added
To answer the second part, you will have to put the second series on the right axis and then invert it

Code: Select all

mygraph.setelem(2) axis(r) mygraph.axis(right) invert

barteph
Posts: 9
Joined: Tue Apr 01, 2014 8:50 pm

Re: More graph programming questions

Postby barteph » Thu Apr 03, 2014 4:52 am

Thanks so much Jason!

How would I program it to give the graph a name say "Value-Added Investment" ?

Finally if I have number of countries for the series how would I do this as a loop

Other then

show VA_France.Line
show VA_Germany.LIne
show VA_Spain.Line
show VA_Greece.Line

and then the freeze command with each of them.

etc

EViews Jason
EViews Developer
Posts: 870
Joined: Tue Sep 16, 2008 3:50 pm

Re: More graph programming questions

Postby EViews Jason » Thu Apr 03, 2014 8:42 am

How would I program it to give the graph a name say "Value-Added Investment" ?

Code: Select all

mygraph.text(t) Value-Added Investment
Finally if I have number of countries for the series how would I do this as a loop

Other then

show VA_France.Line
show VA_Germany.LIne
show VA_Spain.Line
show VA_Greece.Line

and then the freeze command with each of them.

etc

Code: Select all

for %s VA_France VA_Germany freeze({%s}_graph) {%s}.line next

barteph
Posts: 9
Joined: Tue Apr 01, 2014 8:50 pm

Re: More graph programming questions

Postby barteph » Thu Apr 03, 2014 3:32 pm

Sorry I meant to ask how you would loop the renaming of a series in a graph. So I have VA_graph.line.

How would I loop it so that I can rename all the series in the graph?

VA_graph.name(1) France
VA_graph.name(2) Germany
VA_graph.name(3) Italy
VA_graph.name(4) Spain
VA_graph.name(5) Euro Area
VA_graph.name(6) UK

I would also like to add % to the y axis title. How do I program so that axes are labeled.

Thanks

barteph
Posts: 9
Joined: Tue Apr 01, 2014 8:50 pm

Re: More graph programming questions

Postby barteph » Thu Apr 03, 2014 5:50 pm

With regards to above.

mygraph.setelem(2) axis(r)
mygraph.axis(right) invert

What if I wanted the right inverted axis to start at a certain value?

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

Re: More graph programming questions

Postby EViews Gareth » Thu Apr 03, 2014 7:38 pm

All of these commands are listed in the graph section of the Object Reference pdf

barteph
Posts: 9
Joined: Tue Apr 01, 2014 8:50 pm

Re: More graph programming questions

Postby barteph » Fri Apr 04, 2014 7:00 am

where is this pdf or can you send a copy?

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

Re: More graph programming questions

Postby EViews Gareth » Fri Apr 04, 2014 7:15 am

Help menu

barteph
Posts: 9
Joined: Tue Apr 01, 2014 8:50 pm

Re: More graph programming questions

Postby barteph » Fri Apr 04, 2014 8:05 am

I don't see what I want to do in here...can you direct me to page(s)

I can't get setobslabel command to work or label y axis.

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

Re: More graph programming questions

Postby EViews Gareth » Fri Apr 04, 2014 8:43 am


How would I loop it so that I can rename all the series in the graph?

VA_graph.name(1) France
VA_graph.name(2) Germany
VA_graph.name(3) Italy
VA_graph.name(4) Spain
VA_graph.name(5) Euro Area
VA_graph.name(6) UK
Thanks

Code: Select all

%names = "France Germany Italy Spain ""Euro Area"" UK" for !i=1 to 6 va_graph.name(!i) @word(%names, !i) next

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

Re: More graph programming questions

Postby EViews Gareth » Fri Apr 04, 2014 8:45 am

You want the

Code: Select all

graph.axis range
and

Code: Select all

graph.axis format
commands, I think.

barteph
Posts: 9
Joined: Tue Apr 01, 2014 8:50 pm

Re: More graph programming questions

Postby barteph » Fri Apr 04, 2014 11:09 am

Hmm... the loop above doesn't seem to work for me.

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

Re: More graph programming questions

Postby EViews Gareth » Fri Apr 04, 2014 11:20 am

Code: Select all

%name = @word(%names, !i) va_graph.name(!i) {%name}

barteph
Posts: 9
Joined: Tue Apr 01, 2014 8:50 pm

Re: More graph programming questions

Postby barteph » Fri Apr 04, 2014 12:41 pm

when I use this I just get for each series

@word("France Germany Italy Spain ""Euro Area"" UK", 1)
@word("France Germany Italy Spain ""Euro Area"" UK", 2)
@word("France Germany Italy Spain ""Euro Area"" UK", 3)
@word("France Germany Italy Spain ""Euro Area"" UK", 4)
@word("France Germany Italy Spain ""Euro Area"" UK", 5)
@word("France Germany Italy Spain ""Euro Area"" UK", 6)


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests