zeroline problems

For questions regarding programming in the EViews programming language.

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

trymok
Posts: 7
Joined: Fri Jun 14, 2019 1:02 am

zeroline problems

Postby trymok » Fri Dec 20, 2019 6:38 am

Hi,

I'm in the process of making various graphs. In some of them, I want to include a zeroline where it's appropriate. For the zeroline I'm using the following subroutine:

Code: Select all

subroutine zeroline(graph g)
     'sets a zeroline in a graph object, see forum http://forums.eviews.com/viewtopic.php?f=3&t=12748&p=44484&hilit=zeroline#p44484

     ' note units are in graph virtual inches
     %smpl=@pagesmpl
     %smpl1=@word(%smpl, 1)
     %smpl2=@word(%smpl, 2)
     
     '!x_9 = g.@axispos(%smpl1, "b")   ' x pos at observation 9
     !x_end = g.@axispos(%smpl2, "b")   ' x pos at observation 10
     
     'finds observation length in a time-series page
     smpl {%smpl1}  {%smpl1}+1
     %smplaux=@pagesmpl
     %smpl1aux=@word(%smplaux, 1)
     %smpl2aux=@word(%smplaux, 2)
     
     !x_1 = g.@axispos(%smpl1aux, "b")   ' x pos at observation 9
     !x_2 = g.@axispos(%smpl2aux, "b")   ' x pos at observation 10
     
     !obsdist = !x_2-!x_1     ' the width of 1 observation
     !xmax =  !x_end+!obsdist*0.5   'the x pos of the end of the bottom axis
     
     !yzero = g.@axispos(-0.002, "l")   ' y position where the data equals 0
     
     g.addarrow pos(0, !yzero, !xmax, !yzero) linewidth(1.2) color(@rgb(001,001,001)) startsym(none) endsym(none) pattern(1)

    smpl {%smpl}
endsub



My problem is that when I'm formatting my datelabel, the zeroline tends to extend the width of the graf, which is quite frustrating. The code I'm including in my program to format the datelabel is the following:

Code: Select all

{%gr}{%version}.datelabel interval(year, 2, 2) span(on)


I'll post some pictures of the result with and without datelabels so you can see the difference:

with.JPG
with.JPG (18.85 KiB) Viewed 7221 times

without.JPG
without.JPG (17.3 KiB) Viewed 7221 times



So, my goal is to get a four digit datelabel with the zeroline within the width of the graph.

Does anyone have a workaround to this problem?

Trym

Return to “Programming”

Who is online

Users browsing this forum: No registered users and 29 guests