Adding Titles to Graphs

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Jason, EViews Moderator

BCNAV
Posts: 21
Joined: Tue Oct 31, 2017 9:06 am

Adding Titles to Graphs

Postby BCNAV » Thu Nov 09, 2017 12:14 pm

Hi again,

I am using

Code: Select all

%vars="ovr_ecu_m11 ovr_ecu_m14 ovr_ecu_m22 ovr_ecu_m23 ovr_ecu_ktk ovr_ecu_oth" There are many variables here...just a sample for posting

spool a_graphs
!count=1
for %series {%vars}
   freeze(mode=overwrite,{%series}_gr) {%series}_hf.line
   {%series}_gr.draw(shade, bottom,color(ltgray)) 2017.10 2019.12
   {%series}_gr.draw(shade, bottom,color(orange)) 2008.01 2009.03
   {%series}_gr.draw(shade, bottom,color(red)) 2000.11 2004.12
   {%series}_gr.addtext(t) Monthly {%series}
   {%series}_gr.addtext(b) "Red = Sept 11th Effect, Orange = Recession, Grey Shading = Forecast Period"
   {%series}_gr.addtext(l) "Charging Units"
   a_graphs.append {%series}_gr

   if !count<=9 then
      a_graphs.name untitled0{!count} {%series}
   else
      a_graphs.name untitled{!count} {%series}
   endif
   !count=!count+1
   {%series}_gr.save(t=png,d=300,c) R:\Eviews\Graphs\ARIMA\{%series}_hf
next


I some how would like to customize:

Code: Select all

{%series}_gr.addtext(t) Monthly {%series}


I would like the graph title to be: Monthly Custom Variable Text

so for variable ovr_ecu_m11 it would be Monthly OVR-M11

Is there a way to pass the OVR-M11 as part of the loop, or is there a way to add in

%titlenames="OVR-M11 and so on for each variable"

This would make output a bit nicer.

Thanks!

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

Re: Adding Titles to Graphs

Postby EViews Gareth » Thu Nov 09, 2017 1:22 pm

If the individual series already have nice display names then it is a bit easier, but assuming they don't you could just do something like:

Code: Select all

%vars = "ovr_ecu_m11 ovr_ecu_m14 " '.....
%nicevars = "OVR-M11 OVR-M14"  '....
for !i  =1 to @wcount(%vars)
   %series= @word(%vars, !i)
   %nicevar = @word(%nicevars, !i)
   'do stuff here
next
Follow us on Twitter @IHSEViews

BCNAV
Posts: 21
Joined: Tue Oct 31, 2017 9:06 am

Re: Adding Titles to Graphs

Postby BCNAV » Thu Nov 09, 2017 1:36 pm

If I have displaynames setup how can I use them in

{%series}_gr.addtext(t) Monthly {%series}

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

Re: Adding Titles to Graphs

Postby EViews Gareth » Thu Nov 09, 2017 1:44 pm

Code: Select all

%title = "Monthly " + {%series}.@displayname
{%series}_gr.addtext(t) {%title}
Follow us on Twitter @IHSEViews

BCNAV
Posts: 21
Joined: Tue Oct 31, 2017 9:06 am

Re: Adding Titles to Graphs

Postby BCNAV » Thu Nov 09, 2017 1:50 pm

Perfect!!

Cheers


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 10 guests