replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - %PL with x_date
forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

%PL with x_date

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2617
Location: Sydney

PostPosted: Sat Jul 12, 2025 4:29 am    Post subject: %PL with x_date Reply with quote

I am wanting to generate plots based on historical data over a period of years.

Can %PL provide an X axis as date format ?

This also requires the conversion of date to a reference date.
Please not 1/1/1900 with the Excel error.
Perhaps using 1/1/1 as the first day ? with function JDATE

What might be available ?
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 8219
Location: Salford, UK

PostPosted: Sat Jul 12, 2025 8:51 am    Post subject: Reply with quote

John

The native %pl uses %gr so you can call draw_characters@ to draw text. Also link=columns can be used to present vertical columns.
The function GET_PLOT_POINT@ gets the pixel coordinates of a particular point relative to the axes.

Here is a simple example that calls draw_characters@...

Code:
      WINAPP
      MODULE mydata
        USE clrwin
        INTEGER,PARAMETER::n=1000,link_none=0,link_lines=1,link_curves=2
        INTEGER,PARAMETER::all_graphs=0,graph1=0
        LOGICAL shown
        DOUBLE PRECISION y(n)
      CONTAINS
      INTEGER FUNCTION show()
        INTEGER errstate
        errstate = change_plot_int@(0,"link",graph1,link_curves)
        if(errstate /= 0) print*, clearwin_string@("ERROR_REPORT")
        errstate = change_plot_int@(0,"colour",graph1,RGB@(255,0,0))
        errstate = change_plot_dbl@(0,"y_max",all_graphs,1.5d0)
        shown = .true.
        CALL simpleplot_redraw@()
        show = 2
      END FUNCTION show
      INTEGER FUNCTION clear()
        INTEGER errstate
        call clear_screen@()
        errstate = change_plot_int@(0,"link",graph1,link_none)
        shown = .false.
        CALL simpleplot_redraw@()
        clear = 2
      END FUNCTION clear
      INTEGER FUNCTION legend()
        IF(shown .AND. clearwin_string@("CALLBACK_REASON") == "PLOT_ADJUST") THEN
          CALL draw_characters@("Legend:..", 300, 100, 0)
          CALL draw_line_between@(300,120,360,120,RGB@(0,0,255))
        ENDIF
        legend = 2
      END FUNCTION legend
      END MODULE mydata
     
      PROGRAM main
      USE mydata
      INTEGER i,x
      DOUBLE PRECISION p1,p2,p3,z
      !read*,i
      p1=1.5d0
      p2=150.0d0
      p3=15d0
      x=0
      DO i=1,n
        z=p1*sin(x/p3)*exp(-x/p2)
        !print*, i-1,x,z
        y(i) = z
        x=x+1
      ENDDO
      shown = .false.
      i=winio@('%ww[no_border]%ca[Damped wave]%pv&')
      i=winio@('%mn[Edit[Show, Clear]]&', show, clear)
      i=winio@('%fn[Tahoma]&')
      i=winio@('%ts&', 1.1d0)
      i=winio@('%tc&',rgb@(0,0,80))
      i=winio@('%it&')
      i=winio@('%`bg&',rgb@(230,255,225))
      CALL winop@("%pl[native,gridlines]")
      CALL winop@('%pl[title="Sample plot"]')
      CALL winop@("%pl[x_axis=Time(Milliseconds)]")
      CALL winop@("%pl[y_axis=Amplitude]")
      CALL winop@("%pl[smoothing=4]") ! anti-aliasing
      CALL winop@("%pl[link=none]")   ! delay drawing
      !CALL winop@("%pl[scale=log_linear]")
      i=winio@("%^pl",500,400,n,0.0d0,1.0d0,y,legend)
      END


I can look later for date routines if no one else knows how to do this.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group